Set UserRole

0
Hi Mendix Community... I have a sign up microflow that opens a form where you can add you username, password, and date of birth... I want to set the user role with a microflow, depending on the persons age. Can some one help and explain how you set a user role when creating a new account...? Thanks in advance.
asked
1 answers
1

Firstly, create a form that you only use to create new users, and replace the Save button with a microflow button to save the record.

In this custom Save microflow, validate the data entered, including the date of birth, (work out the age from it) and based on this perform a Retrieve action to the UserRole entity in the System module.

Then perform a change action on your User object to Add to the System.UserRoles association with the retrieved UserRole object.

answered