- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 10:03 AM
hey gang,
I'm debugging some ACLs, one in particular has a condition I'm trying to set in script so that the logged in user can read fields on a record only if they are the current entry in one of the fields.
which is of these would be correct? does my script have to have a line for "answer = true"?
var u = gs.getUserID(); //sets u to ID of current user
answer = current.u_customer_contact == u || current.opened_by == u || current.isNewRecord() || !current.getUniqueValue();
OR...
var u = gs.getUserID(); //sets u to ID of current user
if (current.u_customer_contact == u || current.opened_by == u || current.isNewRecord() || !current.getUniqueValue()) {
answer = true;
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 10:28 AM
You don't need to explicitly state answer = true.
As long as answer evaluates to either true or false.
Stylistically, I'd throw some parenthesis in there, but that's just my preference.
var u = gs.getUserID(); //sets u to ID of current user
answer = (current.u_customer_contact == u) || (current.opened_by == u) || (current.isNewRecord()) || (!current.getUniqueValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 02:58 PM
actually figured it out...thanks Justin!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2020 01:24 PM
think i'm trying to figure out a similar issue. ours is to compare the current user's Company value against the record(on sys_user) and restrict write access to one particular field. not quite working yet.
var companyID = gs.getUser().getCompanyID();
answer == (user.isMemberOf("ITSM Service Desk Notes")) && (current.u_company == companyID);