Add action to user

0
Hey, I'm pretty new to Mendix and I'm struggeling with something. What I want to do is: I created some other user roles which are not standard in the Mendix Modeller. I call them 'Employee' and 'Manager'. If I create a Employee through Mendix I want to sync it with 1 Manager which you can choose by a dropdown menu. How can I import only users with the Manager role and add them as a detail to add to an Employee with a dropdown menu? Thanks in advance, Bram
asked
2 answers
3

Hello Bram,

One way to accomplish this would be to use a helper table in between your two instances of the Account entity. This way, every Employee Account can have exactly one associated Manager Relationship, which will in turn have an associated Manager Account.

You will need to create the Manager Relationship object each time you create a new Employee Account, or you will need to make one if one is needed when you open the Account_NewEdit page. The microflow to do that might look like this:

You can then use a reference selector with data source of microflow to set the correct value for ManagerRelationship_ManagerAccount. This XPath retrieve in your microflow will give you the list of all Managers.

answered
0

The UserRole is an entity under System module and it has associations to System.User and Administration.Account is a specialization of the System.User.  So, if your drop down for manager is based on System.User, you can use XPath constraints and looking for only UserRole[Name='Manager'] or something equivalent to that.

Xpath constraint will help you limit only managers and not make the users with employee role appear. 

answered