You can create a group rule to assign a user to groups or exclude them from a group. You can use basic conditions or the Okta Expression Language to create rules.
If you're evaluating attributes from Workday, Active Directory, or other sources, you first need to map them to Okta user profile attributes.
Create a group rule
- In the Admin Console, go to Directory > Groups.
- Select the Rules tab, and then click Add Rule.
- Enter a name for the rule.
- For the IF condition, select one of these options:
- Use basic condition: Select options from the drop-down lists to create a rule using string attributes only. Use this method to create simple rules. For example, those from a single attribute or from one or more groups only.
Use Okta Expression Language (advanced): Select this option to create complex rules with custom expressions.
You can create rules using the following:
- One or more attributes
- One or more groups
- Combinations of attributes and groups
In Then Assign to, enter a single group or multiple groups to which the user should be assigned if the rule condition is met.
IMPORTANT: You can assign a user to maximum 100 groups.
In Except The following users, enter the names of any users you want to exclude from the rule.
- You can exclude maximum 100 users from a rule.
- If you manually remove a rule-managed user from a group, that user automatically gets added to Except The following users for that rule.
- Click Save.
After you create and save a rule, it’s inactive by default. Once you activate it, the rule gets applied to your entire org. The new rule then runs on a user as their profile gets updated through import, direct updating, or other changes. The rule doesn't move users in a Pending or Inactive state.
You can use Okta Expression Language to add a custom expression to a group rule. Custom expressions allow you to refine your conditions, by referencing one or more attributes. See Okta Expression Language.
Group rule conditions have the following constraints:
- Expressions must use Okta Expression Language.
- Expressions must have a valid syntax and use logical operators.
- Expressions must evaluate to Boolean.
- Expressions can't contain an assignment = operator.
- User attributes used in expressions can only refer to available Okta user attributes.
- Only group and user attributes are supported.
- Application attributes aren’t supported.
The Okta Expression Language supports most functions, such as:
- Boolean operators: AND, OR, ! (NOT)
- Arithmetic operators: <, >, <=, >=
- Equality checks: ==
Examples of valid condition expressions
Assume that the user has the following attributes with types:
- firstName (String)
- lastName (String)
- city (String)
- salary (Integer)
- isContractor (Boolean)
Assign to Group (or any action)
|If||user.city == "San Francisco"||sfo|
|If||user.salary > 1000000||expensiveEmployee|
|If||user.salary > 1000000 AND !user.isContractor||expensiveFullTimeEmployee|