How to autoppulate managerid attribute in form after selecting the managername?

0
there are 2 entites Manager and Employee. Manager has 2 attributes managerId and Managername. Employee entity has attributes, empname, empid and managerID which is reference to managerID of manager entity. In a form where employe selects the manager name from dropdown, how to make the managerID of employee entity auto populate with the managerId of that selected manager from dropdown in mendix?
asked
2 answers
4

Hi Harsh,

In the form where you choose the manager's name,

Place a textbox and set’s attribute to manager ID and make it non-editable,

There are two ways, from which you can do it,

1.

When you choose Manager's name, call a microflow, retrieve the manager you selected, and change the manager ID.

2.

on the change of the manager name, call a microflow and refresh the dataview entity,

 

Let me know if you face any issues,

Hope it helps!

answered
0

Harsh,

Having ManagerID on the Employee entity is not recommended as you always can get it through association.

However, if you really want it, you can add an onchange event to the reference selector and use a microflow/nanoflow to set the Employee’s ManagerID of the selected Manager.

answered