- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:39 PM
Hi, I'm trying to display only the Groups of the Requested User Field in my Service Catalog.
Upon using script - "javascript:'user='+current.variables.requested_for;" it only displays sys_id of Groups how to I display the display value of the Groups?
Service Catalog Form:
Variable declaration:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 11:48 PM
there was a type in my above response; it should be IN and not NIN
update as this
javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.requested_for).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
09-14-2023 12:25 AM
Hello @pjftenorio ,
Please try below
your table should be reference to sys_user_group table not sys_user_grmember
and write Advanced reference qualifier as below
javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.<requested_for_field_name>).getMyGroups());
// replace requested for back end name at <requested_for_field_name>
Please mark my answer as Helpful, if it is correct and help you.
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 10:54 PM
your variable should refer to sys_user_group and not sys_user_grmember since you want to show groups
Do this in advanced ref qualifier
javascript: 'sys_idNIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.requested_for).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
09-13-2023 11:13 PM
Hi @Ankur Bawiskar ,
I already updated with the above script but it returns all the group. Not the group of the requested for user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 11:48 PM
there was a type in my above response; it should be IN and not NIN
update as this
javascript: 'sys_idIN' + new global.ArrayUtil().convertArray(gs.getUser().getUserByID(current.variables.requested_for).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
07-23-2024 01:38 PM
Hi @Ankur Bawiskar I have simliar requirment but slight change already that group reference variable had few static groups like (Group1, Group2, Group3, Group4, Group5, Group6) if requested for is part of these 6 groups then display all or else if he is part of first 3 groups out of 6 static groups then display only those 3 groups and exclude rest of the groups How can i achieve this one ?