
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.

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
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.
Select Save.
Related References