
55jek (55jek) asked a question.
Hi,
I am trying to add users to a group when they are members of some other groups (a,b,c) but not in one specific (d). For not including the users of the d group, I use "AND NOT isMemberOfGroupName("d")
example (not working):
isMemberOfGroupName("costcenter_business-operations") OR isMemberOfGroupName("costcenter_accounting") OR isMemberOfGroupName("costcenter_tax-and-treasury") OR isMemberOfGroupName("costcenter_deal-desk") OR isMemberOfGroupName("costcenter_finance") AND not isMemberOfGroupName("20_SF_Finance_Excluded-Users") AND (isMemberOfGroupName("usertype_employee") OR isMemberOfGroupName("20_SF_Finance_NonEmployee-Users"))
any ideas what's wrong? I tried replacing the OR by AND, move the AND NOT statement at start, end, middle but it doesn't work.
Thanks

Hello @55jek (55jek),
Thanks for posting.
There are a couple of suggestions I have for you:
First thing, in the expression you are using just change NOT for a!
AND not isMemberOfGroupName("20_SF_Finance_Excluded-Users") instead use:
AND !isMemberOfGroupName("20_SF_Finance_Excluded-Users")
If this still doesn't work then you could try an expression like this one:
(isMemberOfAnyGroup("Group1ID","Group2ID","Group3ID","Group4ID","Group5ID")
AND !isMemberOfGroupName("20_SF_Finance_Excluded-Users") AND (isMemberOfGroupName("usertype_employee")) OR isMemberOfGroupName("20_SF_Finance_NonEmployee-Users")
In this case, I used the isMemberOfAnyGroup to make it more compact, but instead of using the group names, it is necessary to place the ID.
If none of these options actually work, please explain a bit more about what you are trying, since the first expression you sent is:
User belongs to Group A or B or C, Not to Group D, but yes to Group E or Group F
Please let us know if this helps.
Regards,
Natalia
Okta Inc.
This is actually very helpful. Thank you.
It looks like this will do for now but I'll let you know if there's something else needed in this expression.
Have a good one!
Best