- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
When a user is created, it should automatically assign a group any. I am not able to set the logic to sys_user_grmember table. Kindly help.
Regards
Suman P.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ServiceNow Use6 ,
Here is how your flow looks. Are you getting any errors or warnings during execution?
And also what's the use case here, we can suggest a better approach because just creating a user without any validation is not a good approach!
Result:
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
After creating user, you should check in sys_user table if record exists not in sys_user_grmember table.
sys_user_grmember is table where user and group relations are stored.
I have tried to replicate what you are trying to do, you can follow these steps for understanding basic gist of it and later tweak as per your convenience
Step 1: Trigger user is created
Step 2 : look up record on sys_user table to check if user exists or not
Step 3 if condition to check if look up record is not empty
Step 4: Assign user to group using sys_user_grmember table
Step 5 Testing : using + sign create a new user record and run test
step 6: flow works fine and completed, the above steps work
if you find the answer useful, please mark it as solution accepted/helpful
Thanks and regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @ServiceNow Use6 ,
You shouldn’t be looking in the "sys_user_grmember" table because you are creating a brand new user, and you won’t find that user in "sys_user_grmember". Instead, you should check the "sys_user" table (as I am doing here) to make sure the user was created and exists in the "sys_user" table, and then add the user to the group.
Here my second and third step details
#2
#3
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
After creating user, you should check in sys_user table if record exists not in sys_user_grmember table.
sys_user_grmember is table where user and group relations are stored.
I have tried to replicate what you are trying to do, you can follow these steps for understanding basic gist of it and later tweak as per your convenience
Step 1: Trigger user is created
Step 2 : look up record on sys_user table to check if user exists or not
Step 3 if condition to check if look up record is not empty
Step 4: Assign user to group using sys_user_grmember table
Step 5 Testing : using + sign create a new user record and run test
step 6: flow works fine and completed, the above steps work
if you find the answer useful, please mark it as solution accepted/helpful
Thanks and regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@ServiceNow Use6 If you are creating a new user, it wont be present in any group.
I dont think you need a lookup step.
It should be create user and then add user to group (create record in sys_user_grmember).
Please mark the answer correct/helpful accordingly.