- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 08:33 AM
Create a catalog item withe following details:
Item name : Add User to a Group
Variables:
1. Please select the user. ( it should show list of all the active users so that we can select one )
2. Select the Group. ( it should be showing all the active groups where the user is not already member of it )
Please give me solution for this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 08:47 AM
do this
1) 1st variable add this reference qualifier -> active=true
2) add this in 2nd variable ref qualifier
javascript:'sys_idNOT IN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.firstVariable).getMyGroups());
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
‎06-18-2025 08:50 AM - edited ‎06-18-2025 08:53 AM
Hello @tylerduren7 ,
1. For user variable use advance reference qualifier
active=true
2. for group variable use advance reference qualifier
sys_idNOT INjavascript:gs.getUser().getMyGroups()
replace ":" with ":" in query.
If my answer helps you mark this as correct and helpful.
Sunny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 11:19 PM - edited ‎06-18-2025 11:20 PM
Hello @tylerduren7 ,
you can try like following which is worked for me.
sys_idNOT INjavascript:gs.getUser().getUserByID(current.variables.please_select_user).getMyGroups();
replace : with ":"
Thanks,
Sunny R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 11:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 11:27 PM
Didn't work where user George is already in four groups still reflecting 51 groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-18-2025 09:57 AM - edited ‎06-18-2025 10:02 AM
Hi @tylerduren7 ,
on the 1. please select the user variable add filter like this
on the 2. Select the Group
javascript:'active=true^sys_idNOT IN'+Array.from(gs.getUser().getUserByID(current.variables.please_select_the_user).getMyGroups())
it's javascript: not javascript:
refer the screenshots
Note: in the above line update(please_select_the_user ) with the name of 1st variable (please select the user) if the name is different
Incase of any issues please share screenshots of your variable records
share 4 screenshots 2 for question section's
2 of Type specifications section's
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya