- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2022 10:04 PM
Hi Community,
I created a Script include which returns if the user has exactly the given role.
Calling this script include from List Control Omit Condition but it's not working while refershing the Release List.
Thanks,
Ankita
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2022 04:02 AM
Hi,
You are using the wrong method and wrong lines; I correct them
1) it should be getRoles()
2) it should be split(',')
var au = new ArrayUtil();
var roles = gs.getSession().getRoles() + '';
var roleArray = roles.split(",");
var isRolePresent = au.contains(roleArray, role);
return isRolePresent;
In the Omit new condition script remember to initialize answer as false
line 5 should be
var answer = false;
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2022 11:51 PM
Uncheck the "Omit new button" checkbox and see if its working now.
Please mark helpful/correct if it helped resolve your query.
Thanks,
Saji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2022 11:58 PM
Hi Sajilal,
Thanks.It's working.
But I have a question:-
What's the use of then Omit new button checkbox.As I know If Omit new button is checked ,it checks for the condition to be true or false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2022 12:05 AM
Glad to know that my approach worked.
Why are you testing with admin? admin will have all the roles.
Please test with actual role users
Please mark my response as correct and close the thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 04:08 AM
Would you mind closing this question by marking appropriate my response as correct as my response worked for you?
This would help future members.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader