How to assign multiple user roles to the same user through microflow?

0
Hello Community! When a user signed up, he/she will be assigned with ‘user’ user role. I have an Add button in the homepage, if user clicks on Add button, it creates a Department and the current user is assigned as an Admin. Now the user has two user roles(‘user’, ‘admin’)  How can I achieve this through microflow? Thanks!
asked
2 answers
4

Hi Chandana

 

First you need to retrieve the role you want. You need to retrieve the “System.UserRole” entity from the database and then use this XPath to retrieve the role that you want: (Do this multiple times for multiple roles)

[id = '[%UserRole_USERROLENAME%]']

 

Then create a list and add all userroles you have retrieved to that list. At the end you can change the account object of the user and set the reference “System.UserRoles” to that list containing all userroles (Picture below).

 

 

answered
0

Hi Chandana, 

You can retrieve System.UserRole in the microflow. you can set the XPath to [Name = ‘User’] and a second retrieve for [Name = ‘admin’]. 


You can then use a ChangeObject to add the retrieved user roles to the account. (note in my example the user role variable is called ‘DeploymentTeam’. 

 

You can either add both user roles to a list and add the list where I have $DeploymentTeam. Or use the Add option in the change object twice, one for each user role. 

answered