- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:02 AM
Hi,
I'm writing a business rule on User table, this business rule should execute only if the user is part of a specific group.
Can some one help how to put in Condition in advanced tab. I had a property created with the group Sys id
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:40 AM
Or without toString:
gs.getUser().getUserByID(current.sys_id).isMemberOf(gs.getProperty('name of your property'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:20 AM
Hi Kri,
To check the group from your property use:
gs.getUser().isMemberOf(gs.getProperty('name of your property'))
Replace above 'name of your property' with the name of your property between quotes.
Returns true if the user is a member of the group you specified in your property. Returns false if not a member of that group. So with above it will execute (true) for users part of that group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:23 AM
Hi Willem,
gs.getUser returns the sys id of logged in user, but I need to check the user whose record is updated is part of the Group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:23 AM
Use:
gs.getUser().getUserByID(current.sys_id.toString()).isMemberOf(gs.getProperty('name of your property'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:40 AM
Or without toString:
gs.getUser().getUserByID(current.sys_id).isMemberOf(gs.getProperty('name of your property'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 05:23 AM
Hi,
Is it logged in user or the user who is getting updated
1) If logged in user then this single line should work in BR condition
gs.getUser().isMemberOf("YOUR GROUP NAME HERE")
2) If for the user who is getting updated then below line should work in BR condition
gs.getUser().getUserByID(current.sys_id).isMemberOf("YOUR GROUP NAME HERE")
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader