BR to set user 'active' field to false if member of a certain group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 02:30 AM
We are looking to try and set users 'active' field to false if they are part of a certain group.
However, it appears the sys_user table cannot see the Groups related list, meaning I think we'd have to script that somehow.
Done a lot of scouring and cannot see anything that points to a solution. I see things about checking if a user is in a group, but not then 'do this'. I'm very much a scripting novice
So essentially if user is member of 'test group', then set Active to 'false'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 03:43 AM
Glad to know.
Please mark my response as correct and close the thread.
you need to use before delete BR on sys_user_grmember table and do the reverse
i.e. make the active field as true
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-29-2023 03:49 AM
Unfortunately that hasn't worked. Got it set to before delete on the same table, changed the script to set active to true. Hasn't updated though. As mentioned, there is a Locked Out field that ticks when active goes to false, but when you remove the group, active stays false and locked out stays true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 03:56 AM
when user is added you do this -> mark user as active false and locked out as true
when user is removed then you do this -> mark user as active true and set locked out as false
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-29-2023 05:01 AM
There's another BR that is overriding this for locked out. I've disabled it to test, but active checkbox still doesn't go back to true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 05:21 AM - edited 06-29-2023 05:28 AM
Typing it in manually -: