- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 10:44 AM
Hello - I am trying to setup a rule that will automatically remove users from all groups when they go on leave of absence. We have field on the user record that is automatically update from our HR system if someone goes on LOA. I created a business rule and script to remove the groups. However the script is removing all groups from all users. I am very green on the scripting side so I am sure I missing something. Thank you for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 10:57 AM
There is not a field named 'user' on the sys_user_group table, so this query condition is ignored and every group record is returned. Try using the sys_user_grmember table instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 10:57 AM
There is not a field named 'user' on the sys_user_group table, so this query condition is ignored and every group record is returned. Try using the sys_user_grmember table instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 11:27 AM
This was it, Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2024 11:05 AM
Hi,
I would recommend that you setup a Flow in Flow Designer for this purpose instead.
It will eliminate the need for scripting.
Also, you are doing a query from the [sys_user_group] table which contains the Group records.
Do a query from the [sys_user_grmember] to retrieve group membership records instead.