<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
0D54z00007eRwCQCA0Okta Classic EngineUniversal DirectoryAnswered2026-10-15T17:45:28.000Z2022-05-17T10:39:15.000Z2026-10-15T17:45:28.000Z

OanaM.09449 (Customer) asked a question.

Use Okta Expression Language (advanced) while creating rules with multiple conditions

Hello everyone,

 

I am trying to create a Rule that should add all the users having in the display name the extensions {AUTOSOL/FCTL], [AUTOSOL/FCV], [AUTOSOL/PSS] etc into an OKta group.

This is the syntax that I am using but I am receiving an error:

 

Invalid expression syntax (String.stringContains(String.toUpperCase(user.displayName),"AUTOSOL/FCTL", OR (user.displayName),"AUTOSOL/FCV", OR (user.displayName),"AUTOSOL/LCS", OR (user.displayName),"AUTOSOL/PRM", OR (user.displayName),"AUTOSOL/ACT"), OR (user.displayName),"AUTOSOL/ISV")

 

I also tried to see if it works in the following ways but still no luck:

 

(String.stringContains(String.toUpperCase(user.displayName),"AUTOSOL/FCTL", OR (user.displayName),"AUTOSOL/FCV", OR (String.toUpperCase(user.displayName),"AUTOSOL/LCS"), OR (String.toUpperCase(user.displayName),"AUTOSOL/PRM")

 

Or:

 

(String.stringContains(String.toUpperCase(user.displayName),"AUTOSOL/FCTL", "AUTOSOL/FCV", "AUTOSOL/LCS")

 

Can someone give me an advice?

Thanks in advance.


  • Paul S. (Okta, Inc.)

    Updating this response for ease of access and reference: 

     

    Overview

    When creating an Okta group rule to match multiple strings in a user's display name, the following error occurs:

    Invalid expression syntax (String.stringContains(String.toUpperCase(user.displayName),"AUTOSOL/FCTL", OR (user.displayName),"AUTOSOL/FCV", OR (user.displayName),"AUTOSOL/LCS", OR (user.displayName),"AUTOSOL/PRM", OR (user.displayName),"AUTOSOL/ACT"), OR (user.displayName),"AUTOSOL/ISV")

    This happens because the expression uses incorrect syntax for the OR operator and unnecessarily includes String.toUpperCase. Resolve this by formatting the expression with separate String.stringContains functions that use OR operators between them.

     

    Applies To

    • Okta Identity Engine (OIE)
    • Okta Classic Engine
    • Group Rules
    • Okta Expression Language

     

    Cause

    The expression syntax contains errors. The expression places the OR operator inside the function arguments instead of between separate function calls. Additionally, String.toUpperCase is unnecessary in a group rule because group rules only read attributes and do not write or modify them.

     

    Solution

    What resolves the invalid expression syntax error?

    Navigate to the group rules in the Okta Admin Console and update the expression to use separate string functions that include logical operators between them.

    1. Navigate to Directory and choose Groups.
    2. Select the Rules tab.
    3. Select the affected rule and choose Edit.
    4. Enter the corrected expression syntax.
    1. String.stringContains(user.displayName, "AUTOSOL/FCTL") OR String.stringContains(user.displayName, "AUTOSOL/FCV") OR String.stringContains(user.displayName, "AUTOSOL/LCS") OR String.stringContains(user.displayName, "AUTOSOL/PRM") OR String.stringContains(user.displayName, "AUTOSOL/ACT") OR String.stringContains(user.displayName, "AUTOSOL/ISV")

    Select Save.

     

    Related References

     

     

    Expand Post
    Selected as Best
  • Paul S. (Okta, Inc.)

    Hello @OanaM.09449 (Customer)​  Thank you for reaching out to our Community!

     

    I have tested this expression and this should do what you require, please see below:

    String.stringContains(user.displayName, "AUTOSOL/FCTL") OR String.stringContains(user.displayName, "AUTOSOL/FCV") OR String.stringContains(user.displayName, "AUTOSOL/LCS") OR String.stringContains(user.displayName, "AUTOSOL/PRM") OR String.stringContains(user.displayName, "AUTOSOL/ACT") OR String.stringContains(user.displayName, "AUTOSOL/ISV")

     

    The String.toUpperCase is not need in a group rule as this is used to create capital letters on an attribute and group rules will just read the attribute and not write it.

    Please also see our article on Expression language for the future:

    https://developer.okta.com/docs/reference/okta-expression-language/#samples-using-profile-mapping

    Hope this helps!

     

    Expand Post
  • Paul S. (Okta, Inc.)

    Updating this response for ease of access and reference: 

     

    Overview

    When creating an Okta group rule to match multiple strings in a user's display name, the following error occurs:

    Invalid expression syntax (String.stringContains(String.toUpperCase(user.displayName),"AUTOSOL/FCTL", OR (user.displayName),"AUTOSOL/FCV", OR (user.displayName),"AUTOSOL/LCS", OR (user.displayName),"AUTOSOL/PRM", OR (user.displayName),"AUTOSOL/ACT"), OR (user.displayName),"AUTOSOL/ISV")

    This happens because the expression uses incorrect syntax for the OR operator and unnecessarily includes String.toUpperCase. Resolve this by formatting the expression with separate String.stringContains functions that use OR operators between them.

     

    Applies To

    • Okta Identity Engine (OIE)
    • Okta Classic Engine
    • Group Rules
    • Okta Expression Language

     

    Cause

    The expression syntax contains errors. The expression places the OR operator inside the function arguments instead of between separate function calls. Additionally, String.toUpperCase is unnecessary in a group rule because group rules only read attributes and do not write or modify them.

     

    Solution

    What resolves the invalid expression syntax error?

    Navigate to the group rules in the Okta Admin Console and update the expression to use separate string functions that include logical operators between them.

    1. Navigate to Directory and choose Groups.
    2. Select the Rules tab.
    3. Select the affected rule and choose Edit.
    4. Enter the corrected expression syntax.
    1. String.stringContains(user.displayName, "AUTOSOL/FCTL") OR String.stringContains(user.displayName, "AUTOSOL/FCV") OR String.stringContains(user.displayName, "AUTOSOL/LCS") OR String.stringContains(user.displayName, "AUTOSOL/PRM") OR String.stringContains(user.displayName, "AUTOSOL/ACT") OR String.stringContains(user.displayName, "AUTOSOL/ISV")

    Select Save.

     

    Related References

     

     

    Expand Post
    Selected as Best
This question is closed.
Loading
Use Okta Expression Language (advanced) while creating rules with multiple conditions
Okta Support Agent (Beta)

Terms of Service

Hello! I'm the Okta Support Agent (Beta), your go-to resource for questions about Okta products. Please remember for your security and privacy, do not share any Personally Identifiable Information (PII) such as passwords, IP addresses, or other details with me.

Okta Privacy Policy and Terms of Service apply