How to check current user role in the microflow?

How can I check the current user role? I have a form, where input fields are editable depending on the current user role. One user can have multiple roles, so I need to check if a user has a particular role among others, and if yes, then input fields in the form should be editable. How can I create a condition based on the current user role in the microflow? I can get the list of roles assigned to the current user account, but how can I check if he has some particular role or not?
3 answers

Hi Maxim,

Create a boolean variable in the entity connected to the form. Create a microflow with one activity like below image and then this will retrieve the userroles associated to the currentuser Then check whether the respective userrole exist or not. If exist set boolean to true if not set to false. Set the conditional editability to all fields based on this boolean value


In a microflow you can easily get list of user roles from $currentUser system variable and then you can iterate list to compare with your user role.
But I think in above scenario you are looking to create conditional form fields. So in that case I suggest to work with conditional visibility. Show fields only for specific user roles. and if you want to show disabled input fields for other user roles you can also configure that. 

Please check the conditional visibility roles section


Hi Maxim,

You have two ways to check the user role: 1. Using System variables 2. Using Module roles

In system variable, you can use [%CurrentUser%] system variable.

In case of module roles, you can create one entity for user roles, you can retrieve data from those user roles in the microflow . In retrieve activity, select retrieve by database, you can set xPath to identify the user role.

See documentation :

Thank you.