- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2023 10:37 PM
Hi Team,
I have created catalog request to add roles to groups.
Now, i want to not show the roles that are already in selected group.
Example if group Next gen already has itil role, so i should restrict it in list collector from user selection to avaoid redundant addition.
Kindly help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 01:34 AM
then use this in advanced ref qualifier and add this in variable attributes
ref_qual_elements=group
I assume the roles variable refer to sys_user_role table
javascript: var query;
var arr = [];
var option = current.variables.action; // give correct action variable name here
var gr = new GlideRecord("sys_group_has_role");
gr.addQuery("group", current.variables.group); // give correct group variable name here
gr.query();
while (gr.next()) {
arr.push(gr.getValue('role'));
}
if(option == 'add_role') // give correct choice value to compare
query = 'sys_idNOT IN' + arr.toString();
else
query = 'sys_idIN' + arr.toString();
query;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 03:08 AM
add this in variable attributes
ref_qual_elements=group;action
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 03:06 AM
@Ankur Bawiskar Even after changing its shows the same.
As told i have called script include from both variables is this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 03:08 AM
add this in variable attributes
ref_qual_elements=group;action
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 03:13 AM
@Ankur Bawiskar Thanks Much for your time its working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 03:16 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader