Check user role in exclusive split

I am trying to check a user role in exclusive split with the following code: $currentUser[system.UserRoles = '[%UserRole_administrator%]'] What am I doing wrong? Link to screenshot:    
3 answers

The tokens for userroles are only available in Xpath retrieves, this is a regular microflow expression. And the brackets you use are only used in Xpaths, not here.

So first do a retrieve of a userrole object where ID = userrole_token. Then you can do an exclusive split to check if the association from currentuser to userrole matches that object.


You are using an XPath expression in an exclusive split. 


I had the same kind of issue. But I had to check if the user had a certain role. This is what I did to solve it. 

  1. You can get the account from a retrieve with: [id = $currentUser/id] (range = first)
  2. I then got all the userroles linked to the account. (retrieve association account)
  3. Retrieve the userrole you need. (retrieve UserRole : [id = ‘[%user you want%]’]
  4. filter with a list operation (contains)


Hope this helps for in the future!