UI Policies based on Logged-in user's role
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 05:19 AM
Hello,
Is there a way to execute an UI policy based on logged-in user's role?
My understanding is, that's not possible. However, as per servicenow docs which says, "Basic UI policies do not require any scripting, however for more advanced actions, use the Run scripts option." , this could be implemented with script with a line of code to check logged-in user's role.
But what I see in Kingston, "Run Scripts" will execute the code, only when condition is met and scripting can't serve as code to check condition.
So, is it possible to execute an UI policy based on logged-in user's role?
Thanks.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 05:37 AM
Hello,
Yes, you can use UI Policy to check for a users role and if true, do something.
You'd leave the condition part alone, which means that it would always net true...or "run"...and then it would run the script in the "true" section of the script tab.
You'd then utilize, g_user:
https://www.servicenowguru.com/scripting/user-object-cheat-sheet/
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!