- 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
@ServiceNow Use6 once the user is created, your second step should not be lookup , it should be create record.
In the create record step, you need to select the table as sys_user_grmember and select value of user from previous step(create user) and select group as per your requirement( which you want the user to be member of).
Please mark the answer correct/helpful accordingly.
- 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
Hi @ServiceNow Use6 ,
1) No need for a Look Up Record action for sys_user_grmember. if you want u can validate for user created, by using lookup record for user record created
2) then on the next step after look up record found for user, you can use a Create Record action with the table set to sys_user_grmember
3) For the User field, insert the data pill from the lookup record of user (dot walk to the user’s sys_id).
4) Then select the group you want the new user to be added to
If you find this 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 @Hemanth M1,
I have a question, actually i manually did it before i attempt in flow designer. I created a user in user table and then i checked for the record in sys_user_grmember table but i can't find the record. In your second step, user will not be found right.
@Mohammed8 asked me to selct the sys_id corcerning the first step or the trigger step, as soon as i do it, it is changing to user table and not living in sys_user_grmember table anymore.
Regards
Suman P.