Entity Access Rule -XPATH ISSUE : Need Solution

Hi, I have the domain model entity structure like this:  For every user, There is an entity account and one account object is associated with multiple APL objects. Those APL objects are getting associated with different location objects and each APL object have attribute’s (FromDate and ToDate). In the application level there are thousands of case records which are associated with different locations, Now I want to filter out those case records (by restricting the entity case access rule XPATH) which are associated with those locations, User account APL object is associated with. And also those fromDate and toDates range defined for each APL. So the problem which i am facing is listed below:   I have 2 User’s like, Ms1 and Ms2 and one location like london. Ms1 user APL object has fromDate mentioned as 9/1/2020 and Ms2 user APL object has date mentioned as 8/28/2020. So before adding the Ms2 user rules, If i login to Ms1 user, it’s filtering out cases properly on the basis of date range’s for london location. Now, If i add Ms2 User Rule for same location (london) with different date range’s, The Ms1 user filtered out results are getting overriding with the Ms2 user date range rules.   Please help me by checking the entity rule xpath issue shown below: [     Deactivated = 'false' and MasterData.CPL_Case/MasterData.CPL[Deactivated = 'false']      [              (MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL/fromDate = empty                         or createdDate >= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL/fromDate)                  and                 ( MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL/toDate = empty                         or createdDate <= MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL/toDate)                 and MasterData.CPL_Location/MasterData.Location/Portal.APL_Location/Portal.APL[LocOnly='true']                      [                     Portal.APL_Account='[%CurrentUser%]'                 ]                 ]                                ] Here, CPL = Case Details object APL = APL object Account = Account object Location = Master Data Location object        
2 answers

Let see if I understand this correctly. Am I correct that each location stores a fromDate and you use that date to filter for a user the APL objects. And each user is allowed to change that date to filter the relevant APL objects for that user. And yes with a setup like that if one user changes that date it will influance it for all the users. But why is that date connected to a location? It seems to me this is a user setting so I would rather create an object that stores that date for a certain location for that user. Or am I missing the problem here?





Hi Pavan,

Are you aware that you are actually comparing to the createddate of CPL instead of the createdDate of the Case?

I hope this helps.


btw: i am curious how you could create an entity called “Case”, because Case is a reserved word in Mendix.