- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 12:31 PM
I have a flow that I created that automatically creates a new user record in ServiceNow when a certain task is created. This works fine, however I want to now add the user to a role and it is not functioning.
I grab the User Record created in the designer (which, again, has been successfully created), then try to add Roles. I am using the sys_id of the role in which I would like to add. However, the role never gets added.
Has anybody accomplished this in the past?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 01:24 PM
You can't add a role like that.
If you really want to add a role you need to add an entry to the sys_user_has_role table, but you should really add the user to a group (sys_user_grmember) and let that group inherit the role you're trying to give out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 01:24 PM
You can't add a role like that.
If you really want to add a role you need to add an entry to the sys_user_has_role table, but you should really add the user to a group (sys_user_grmember) and let that group inherit the role you're trying to give out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 01:49 PM
I appreciate the response! I created a group that contains the role I want to add. When I attempt to update the user record with the group, "Group" is not an available field on the record. When I switch the table to sys_user_grmember, the "Record" field disappears, so I'm not exactly sure how to add the user to the group via Flow Designer unfortunately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 01:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2020 02:09 PM
Here's a breakdown in screenshots (for this example "Hiring manager" is the person you want to put in the group, and "hiring group" is the group you want to put them in, it was the first catalog item I found with user and group details in :))
Edit: I've noticed an error in the first screenshot, but I've already deleted the demo flow - it should check both the user and the group!!