Filter a List by a CurrentUser attribute

Dear all,   my App has the purpose of managing equipment data (e.g. machine name, age, condition, etc.) for several production plants by Users that are working in the plants. These plants can be distinguished by a plant number which is currently stored as an enum value  (e.g. 1111, 1112, 1113, etc.) over an association Equipment_Plant     The data of all equipments was initially imported through an excel upload that maps the attributes, parses enum or boolean values and so on. So there is no “link” between Accounts and equipment data.   The users will register on the app and fill in their respective plant number in the process. Only users of a certain plant should see and edit the machines with the same plant number. Therefore I can save the plant number in the User’s profile via an association Account_Plant.     Now I want to Login as User A with the plant number 1234 and only show the Equipment that also has the plant number 1234 associated with it.   I have tried two different options: Using Xpath in the data grid to filter the equipments by the current user’s plant number → that seems not to work because attributes of the current user cannot be accessed. Using a Microflow as Datasource for the data grid but I cannot figure a way to make it work. I want the data source microflow to give me a list of objects where Equipment_Plant/Plant/plant_number = CurrentUser/plant_number. Any suggestions to solve this or learning paths that will guide me in the right direction?   Thanks in advance Tobias    
1 answers

Hi Tobias,


You have the Plant association connected to your Account entity, but the currentUser is of type System.User


In order to make the microflow datasource work you will have to first do a database retrieve of the account. You can do this with xpath [id = '[%CurrentUser%]’]


After this you can make your second option work.