How to show the data on the basis of user logged in role

I am trying to build a portal in which i need to show the records to the person who matches the unit. Suppose I am the person going to use the portal, and my UNIT is CTO1 then i should be only viewing CTO1 records. No other records should be visible to me.    Till now i have created few roles such as Administrator, User and created few role CTO1 and CTO2 gave the permission same as User.    Now, i have AllRecords page, where iam using Xpath to get the records, but i have to hardcode the value to get the respective records.  I want it be dynamic.     
1 answers

Hi Prince, the best way to achieve this, is by using entity access. If you associate both the record and the person to the unit you're mentioning, you can write a dynamic xPath constraint to show records of a certain unit, as long as the unit is also connected to the logged-in user.


Hopefully, this helps. Otherwise, you might want to share a screenshot of your impacted domain models so we can help you further.