Automatically assign userrole to account

Currently we are working on a project where we have to make accounts for a few types of users. We want to make a microflow to automatically assign an userrole to an account, but we get stuck. For example, when you click: 'add doctor', the userrole automatically is 'doctor'. Does anyone know how to solve this problem? Thanks in advance.
1 answers

You would need to create your own version of the account management screen. The roles are connected as a many to many relation.

The steps in your microflow would be:

  1. Create a list of UserRole
  2. Retrieve the role by its code. (Best use a constant to avoid hardcoding role codes in your microflows)
  3. Add the role to the list
  4. Create the account and assign the list to association UserRoles.