<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007JW6lHCATOkta Classic EngineDirectoriesAnswered2024-04-16T12:15:03.000Z2021-11-27T22:28:27.000Z2021-11-30T12:38:49.000Z

55jek (55jek) asked a question.

Expression Language rules

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.

    Expand Post
    • 55jek (55jek)

      Hi Natalia,

      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
      Expand Post
This question is closed.
Loading
Expression Language rules