Hi,
Any suggestions on how to achieve this efficiently?
I have users in the system that have different logins but the same email address. I'm using the getusersby() function and getting this array of users (typically 2 users) via their email address.
I would like to now take this user array and determine which one is a member of Group A and return that one user account.
I was thinking of an expression rule that basically:
-If count(pv!users)=1, pv!users[1],
if pv!users[1] is member of Group A, pv!users[1], pv!users[2]
However, in this solution, it only accounts for 2 accounts returned and assumes that if the first user account is not in Group A, then the 2nd one must be.
This will probably work in our environment but I would prefer to have something that is more flexible and can loop through more than 2 and doesn't assume the 2nd account is in the group if the first one isn't a member of it.
Any suggestions?
Thanks in advance.
Discussion posts and replies are publicly visible
Hi garym,
An expression rule something like below should accomplish your requirement.
filter(
isusermemberofgroup(
_,
/* Group Id of the Group that you want to check the presence of the User. */
pv!groupId
),
/* Process Variable that holds an array of Users. */
pv!users
)
The above rule filters the Users that belong to the Group you specify from the total list of Users. Hope this helps.
Thank you,
Arun