<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
0D54z00009jGL3WCAWOkta Identity EngineIdentity GovernanceAnswered2026-02-27T09:00:28.000Z2023-10-05T14:15:56.000Z2023-10-09T18:46:20.000Z
sogi1 likes this.
  • Mihai N. (Okta, Inc.)

    Hi @sogi1 (sogi1)​ , Thank you for reaching out to the Okta Community! 

     

    I'm not 100% sure I understood your use case or restrictions but assuming I got it right, please try the following: 

     

    ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2170")) OR ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2166")) OR ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2165"))

     

     

     

     

    If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you. 

     

    Hope my answer helps! 

    --------------------------------

    Headed to Oktane? Here's what you can expect, plus all the Okta tips you may have missed this month

    Expand Post
    Selected as Best
  • Mihai N. (Okta, Inc.)

    Hi @sogi1 (sogi1)​ , Thank you for reaching out to the Okta Community! 

     

    I'm not 100% sure I understood your use case or restrictions but assuming I got it right, please try the following: 

     

    ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2170")) OR ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2166")) OR ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2165"))

     

     

     

     

    If my answer helped, remember to mark it as best to increase its visibility for other members of the Okta Community who might have the same questions as you. 

     

    Hope my answer helps! 

    --------------------------------

    Headed to Oktane? Here's what you can expect, plus all the Okta tips you may have missed this month

    Expand Post
    Selected as Best
  • sogi1 (sogi1)

    thank you so much for your reply. I am trying to figure out a way to do that without having to have all that code. I have been trying to see if I can use a Regex or something like...

    Regex"(?i)

    323|0324|0546|0553|0556|0580|0957|1080|1100|1120|1127|1150|1160|1240|1242|1260|1290|1470|1513|1589|1625|1626|1705|1706|1708|1816|1817|1818|1946|6320|DP600|DP810|2170|2171|2183|2184|2185)")

     

    Expand Post
    • Mihai N. (Okta, Inc.)

      Understandable if you are dealing with a large number of department values, but Regex is only used for group filtering functions, so it won't work for this use case. 

      Based on the numbers listed, I believe it's worth asking if you have even more departments that users are not part of. If not, perhaps consider a rule expression based on the exclusion out of the rest.  

       

      For example instead of setting up a rule where user is e1 or e2 and part of any these 20 departments maybe you can set up something like user is e1 or e2 and NOT part of any of these 3 departments (that might be left if that list is shorter). 

      Expand Post
      • sogi1 (sogi1)

        Thank you for your reply. We have hundreds of departments and the okta group membership that I am trying to create has about 25 departments. So instead of having this for each department nbr ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2170")) I am hoping to be able to have it be one line. you mentioned too do a rule not part of. can i do the opposite using the statement above and say part of ??? the problem is to the department number have nbr - description (6091 - Information security) so I need to do a starts with command. Is there a way to do something like ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith (Regex"(?i)

        323|0324|0546|0553|0556|0580|0957|1080|1100|1120|1127|1150|1160|1240|1242|1260|1290|1470) ????? thank you again for your help

        Expand Post
      • Mihai N. (Okta, Inc.)

        I understand. Unfortunately, regex is not supported in this context.

      • sogi1 (sogi1)

        thank you for all your help. We are using the regex with groups and that explains why i could get it to work with a user attribute. looks like I will have to have the statement for each department. I might find out anyway but is there a character limitation to what i can have there? ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2170")) or ((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2180")) or((user.employeeType=="E1" OR user.employeeType=="E2") AND String.startsWith(user.department,"2270")) .....

        Expand Post
      • Mihai N. (Okta, Inc.)

        There are none that have been documented for this use case and I don't think there's cause to worry, but hypothetically speaking I would imagine there is a technical limit based on the API calls being made and the request size in MB, for example as mention here: https://support.okta.com/help/s/article/What-is-the-maximum-allowed-size-of-an-Okta-attribute?language=en_US

         

        If you do somehow hit a limit, let me know and I'll run it up the ladder. If we can't do anything about it, to at least have it properly documented.

        Expand Post
      • sogi1 (sogi1)

        thank you for the quick reply. if it does reach a limit-- i can create 2 or 3 rules to add members to the okta group (not ideal but it will work) thank you again for your help.

This question is closed.
Loading
Okta expression- select multiple values and put into 1 group