- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 04:11 AM
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!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 06:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 05:34 AM
"getValue()" does not work when dot-walking along with reference fields
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 06:52 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 08:46 PM
Hello @Tony Flower ,
If would be helpful, if you can please accept my solution.
Appreciate your help!!
Thank you.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2023 07:10 AM
Thank you both for your help. 🙂