- 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-30-2020 02:47 PM
Super helpful! This worked! Thank you so much for explaining this to me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 02:11 PM
Hi Jesse - in addition to adding the user role either to 'sys_user_has_role' or by adding user to the 'Groups' table, ensure your flow is set with proper 'run as'.
For instance, if the flow is set to run as 'User who initiates session', then that user should have enough permission to assign/manage roles.