XPATH issues in ListView

I have come across an issue where XPATH does not return the correct result in a listview from the database. Scenario: In my application users go through series of steps in a wizard and assign a package they are working on to different user within their organization. On this assignment page, I have a listview which would retrieve users (stored in its own entity that is generalization of Administration.Account) using XPATH. The XPATH retrievers users with certain role (not all roles).  Setup:  User Entity (generalization of Adminstration.Account) Organization Entity (connected to User) Package entity (connected to both user and organization) User entity is connected to System.UserRole There are total of about 12 user roles for different modules The listview is nested within Dataview Issue: The page that has listview, I am using data source as User entity with XPATH and following conditions: [Module.User_Organization/Module.Organization/Module.User_Organization = '[%CurrentUser%]'] ← This retrieves all users from current user’s organization since there are more than one organizations and the package can only be assigned to users from same organization as the current user [id != '[%CurrentUser%]'] ← Excludes current users since you cannot assign it to yourself [System.UserRoles/System.UserRole/Name != 'roleX'] [System.UserRoles/System.UserRole/Name != 'roleY'] [System.UserRoles/System.UserRole/Name != 'roleZ'] [System.UserRoles/System.UserRole/Name != 'Administrator'] ← want to exclude users with these roles but get the rest of them   The issue I am having is that the listview is acting very sporadic with following symptoms: Sometime the listview will not return any result at all Sometime the list of users will be there  I have added sorting by Full Name (which doesn’t work and the users are listed in random order) I have added search field by Full Name but when I try to search using someone’s name, it doesn’t do anything. The list seem to be getting refreshed but all of the users are listed there and nothing is getting filtere and the order stays random Also, if a user has multiple roles like ‘roleX’ and ‘roleY’ or ‘roleZ” and ‘Administrator’, it will still list this user in the view even though both or all are in excluded list If a user only has one of the role from excluded list, then the user won’t show up which is working as intended but it doesn’t work for multiple users. I have tried using microflow as DS but the multiple role issue is still there and also I don’t get the search capability
1 answers

I'm not getting the whole thing, but one thing you should do is exclude userroles differently, since your users can have multiple roles. In your setup you’re asking “does this user have a role that is not roleX and does this user have a role that is not roleY”.  If a user has both roleX and roleY this is always true. It has a role other than roleX (which is roleY) and it has a role other than roleY (which is roleX).

If you do as follows, you’re asking “does this user have a role that is neither roleX nor roleY etc.:

Name != 'roleX' and
Name != 'roleY' and
Name != 'roleZ' and
Name != 'Administrator']]