Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Iam working scripting questions

MdImranK
Tera Contributor

If there is a custom field on click of UI action I want to populate count of incident which are from same assignment group and I want to show this field to only admin or ITIL user which modules you will use for this?

current_assignment_group! ==" && gs.hasRole('Itil','admin'); iam getting issue in this condition this condition is not getting satisfied

1 REPLY 1

Brad Bowman
Mega Patron

To clarify, the condition on the UI Action controls who can view the UI Action and under what circumstances.  To only show it on records where the Assignment group is empty and the user has either the ITIL or Admin roles, you can change the condition to:

current.assignment_group!=" && gs.hasRole('itil');

since the hasRole method evaluates effective roles - so a user with only the 'admin' role will evaluate to true for 'itil' since admin contains itil. Along with fixing the other typos and syntax errors, to include more than one role would look like this:

current.assignment_group!=" && gs.hasRole('itil, contract_user');