Hi,
The case you are describing can be implemented using xpath constraints in entity access. Did you check out the reference documentation on this subject? https://docs.mendix.com/howto/logic-business-rules/define-access-rules-using-xpath/#3-defining-the-access-rules-on-the-order-entity-using-xpath
An excellent learning path on this subject is https://academy.mendix.com/link/paths/62/Constrain-Your-Data-Using-XPath
In case you already checked these resources and are still struggling: what exact step is it that is blocking you?
I hope this helps.
Hi Dev,
I created the Domain Model like this:
With most examples, I observe a 1:1 association of the Person (Or Employee etc ) Entity with App → Marketplace modules → Administration.Account. If you have a generalization, the next MF will be shorter.
Notice I have created an association between Person and Person. MEndix automatically names this association Person_Person and I renamed it to Person_BULead in order to make it more clear. In your application, you can select the BULead when creating the Person using a Reference Selector. By doing this, you also can retrieve the list of Persons for the Person that is the BULead. I would not work with roles in Enummerations if you only need it for this purpose. If you do use it, you still need the association of the Person in the Role Enum Sales with the Person in the Role Enum BU Lead.
Next is the MF that can service as Data Source:
In the first part, I see to it that I get the Person Object from the current user, the second part is retrieving the Customers of all the subordinates, the last part is retrieving the persons own customers. In this case the MF works for persons in the role of Sales and BULead.
Go Make It