Display records o particular role

0
Hello All,   I have sales person, BU head and Admin roles.  I want something like this,  Sales Person A,B,C,D are under the BU head “XYZ” and sales person E,F,G are under BU Leader “PQR”. Sales persons have their customers which only they and their BU leaders can only see. My query is how to show the only customer record of that sales person who are under a particular BU head. Simply BU head can only see the customers list of Sales Person A,B,C,D. How can I achieve that ? How can I link  that?
asked
2 answers
0

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.

answered
0

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

answered