Data visibility based on user

Hii guys, Iam building an application, in that i have created an entity called person. using that entity i will create different person objects. Now the challenge is whenever a user login to the application,then record which matches the USER NAME of user and NAME of person object will be shown, all other person records will’nt be shown to this user. that means based on username of user and name of person(person entity), respective person record will be shown. can anyone tell me hpw to do this. as iam a newbee to mendix please explain in a detailed manner. Thank you for reading.
1 answers

Hi Akash,

Usually I would try not to save the same data twice on two different entities and just use the account entity, but if you have to use a person entitiy, I would do the following:

- Create a 1-1 association between person and account

- When creating a person object, retrieve the matching account and set the association

- On your page set a dataview with data source microflow to retrieve an account

- In the data source microflow, use a retrieve action on acount using the following xPath: [id = '[%CurrentUser%]']

- In the dataview you just created set a dataview for Person. You can now get the person from the context over the association you just created.

Hope this helps!