- 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 03:52 AM
Hi Ankita,
Can you confirm is script include is calling without new ??
In 6 th line var hasrole= new hasRoleExactlyServerSide()
Thanks
Chandu Telu
Please Mark ā
Correct/helpful, if applicable,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-08-2022 10:35 PM
you should specify the condition like this hasRole(). because it is a method
- 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:23 PM
Hi Ankur,
I made the changes as per your suggestions:-
Calling this script include from Background script it's showing error as :-
Kindly help what's wrong with this?
Thanks,
Ankita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-09-2022 11:47 PM