
ulazx (ulazx) asked a question.
Group expression for pulling in users by manager and user type
I am trying to populate groups based on managers. i have this so far
user.userType=="Employee" AND String.stringContains(user.ManagerUPN,"manager1@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager2@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager3@mydomain.com")
IT seems to work if its just the strings but when I want to be more granular by only pulling in the users whose User Type is Employee is doesnt want to work as it still will add Contingent Workers to the group. Seems I am missing something very simple.

Could this just be the grouping of the logical functions? For example:
String.stringContains(user.ManagerUPN,"manager1@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager2@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager3@mydomain.com")
will return any string that contains any of those matches. But this:
user.userType=="Employee" AND String.stringContains(user.ManagerUPN,"manager1@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager2@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager3@mydomain.com")
will return any string that has an Employee user type and matches manager 1, or anyone that matches manager 2, or anyone that matches manager 3. Is the logical grouping you're looking for this?
user.userType=="Employee" AND (String.stringContains(user.ManagerUPN,"manager1@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager2@mydomain.com") OR String.stringContains(user.ManagerUPN,"manager3@mydomain.com"))
Tim,
By the grouping itself pulls all the users who are reports to the managers but when i add the user.userType="Employee" it doesn't filter out users that have the usertype of Employee only, it still pulls in Contingent Worker types
But did you see my different grouping of the logic, above? Does this not change the results?
The middle grouping and last grouping are the same except for the extra parenthesis at the end... I must not be seeing this correctly 🙂
The last expression has an opening parenthesis after the AND. Essentially you want to OR all the possible manager string matches, and then AND the result with the user type, right? Try copy-pasting it to see the difference.