- 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 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 01:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 01:08 PM
Selecting "--None--" applies the rule to the table. Selecting "*" applies the rule to all fields on the table.
The information, especially the diagrams, on this Wiki site always help remind me how ACLs are evaluated: http://wiki.servicenow.com/index.php?title=Using_Access_Control_Rules#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 01:25 PM
so then would I need 2 ACLs? one to grant access to "read" the table, and then a 2nd to grant access to "read" all the fields on the table?