Function getValue not allowed in scope error when dot walking

Tony Flower
Tera Contributor

We're developing a scoped app with ACLs that call a script include.  One of the tables invokes the following code from the script include, which works fine:

// check user is on authorised list
        var access = false;
        var canWrite = this._isUserOnAuthorisedList(userId, recordGr.getValue('authorised_users'));
        if (canWrite) access = true;
        return access;

 

Another table calls similar code from the script include, but this throws out the error "Function getValue not allowed in scope..."

// check user is on authorised list
        var access = false;
        var canWrite = this._isUserOnAuthorisedList(userId, recordGr.parent.getValue('authorised_users'));
        if (canWrite) access = true;
        return access;

 

If I take out the getValue, it works, but not using getValue doesn't seem like good practice.

// check user is on authorised list
        var access = false;
        var canWrite = this._isUserOnAuthorisedList(userId, recordGr.parent.authorised_users);
        if (canWrite) access = true;
        return access;

 

Can someone explain what's going on here?    Thanks!

 

 

 

 

 

1 ACCEPTED SOLUTION

Johns Marokky
Tera Guru

Hi @Tony Flower ,

There is no harm in using scripts without any getValue code.

if getValue ()” does not work when dot-walking along with reference fields, so you will want to use “toString ()” instead to force the value to a string (e.g. gr.caller_id.department.toString () to get the sys_id of the User’s Department) 

 

Mark Helpful if it helps in resolving your query.

 

Regards,

Johns

View solution in original post

4 REPLIES 4

Shraddha Kadam
Giga Sage

"getValue()" does not work when dot-walking along with reference fields

Johns Marokky
Tera Guru

Hi @Tony Flower ,

There is no harm in using scripts without any getValue code.

if getValue ()” does not work when dot-walking along with reference fields, so you will want to use “toString ()” instead to force the value to a string (e.g. gr.caller_id.department.toString () to get the sys_id of the User’s Department) 

 

Mark Helpful if it helps in resolving your query.

 

Regards,

Johns

Hello @Tony Flower ,

If would be helpful, if you can please accept my solution.

Appreciate your help!!

 

Thank you.

Tony Flower
Tera Contributor

Thank you both for your help. 🙂