- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 11:10 PM
Hi,
My below script is no getting executed when I put in the sys id of an assignment group. It works fine when I use the gropu name.
g_scratchpad.grp = gs.getUser().isMemberOf('Incident-Management_INCPRBCAT');
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 11:15 PM
Hi,
The isMemberOf() function takes group name and not sys_id. check the link below
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=GUser-isMemberOf_S
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎01-17-2019 11:15 PM
Hi,
The isMemberOf() function takes group name and not sys_id. check the link below
https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=GUser-isMemberOf_S
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎01-17-2019 11:20 PM
How can we use the sys ID instead because group names can change in future thus breaking the functionality?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2019 11:27 PM
Hi,
As of now that won't be possible using isMemberOf() unless ServiceNow changes the function definition.
you need to query sys_user_grmember table with that user id and group sys_id, that is the only way as of now
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎05-13-2022 01:03 PM
Good news. In ROME, you can pass in a Group Name OR a Sys_Id, and it will work either way.
Make sure that the GROUP you are searching for is ACTIVE, otherwise the function will return false even though the user actually IS a member. This is very confusing.
https://community.servicenow.com/community?id=community_question&sys_id=b43fe555db56e410a08a1ea66896192f