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 05:31 AM
I think there's some other logic for locked_out which you will have to figure it out
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:32 AM
I think locked_out is a red herring. It's simply not putting active back to true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 06:14 AM
@Ankur Bawiskar so more on this - it's not picking up that the group is being removed. I've tried before and after. Tried insert, update, delete. Tried Group 'is not', 'does not contain' 'changes' and 'changes from' but none of them trigger.
Only way it seems to work is setting 'changes to' or 'is' a different group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 06:59 AM
Any more ideas? That script doesn't work for putting them back to active, because it doesn't seem to recognize a user being removed from the group.
Also when it's an LDAP import, this doesn't work at all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 07:01 AM
I simply need something that does the following.
If a user is added into a certain group, their account 'active' flag get unticked.
Then, if the user is removed from this group, their account 'actie' flag gets ticked again.
Yet there seems to be no way of easily doing this. I'm thinkig it needs to be a full on client script, but unsure how to go about it.