- 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 11:54 PM
Hi @pjftenorio ,
To Display the group's name instead of SysID, In the Pop up view of groups iteself, Go to Configure --> List Layout and Select the User Field to the Right side. Refer below image:
I hope this helps. Mark my answer correct & Like Helpful, if Applicable.
Thanks!
Venkatesh Nekkanti
- 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