In this guide:
Okta Workflows guides offer questions and answers from the Okta Workflows community office hours. They also come from the #okta-workflows channel on the Mac Admins Slack, as well as other places. Read all the other guides.
How do you add users to multiple groups based on their department using Okta Workflows?
This guide will teach you how to add users to multiple Okta groups based on their department using a Workflows table lookup.
Add Users to Multiple Groups Based on Department
You keep the department-to-group mapping in a Workflows table. The table has two columns: department and group. A department can have several rows, one for each group its users should belong to. To change which groups a department gets, you edit the table and leave the flows alone.

The automation has 3 flows:
- List users: lists active users and streams each one to the List groups flow.
- List groups: looks up the user’s department in the table and returns all the groups associated with it.
- Add to group: finds the group by name and adds the user to it.
List users flow
The List users flow lists all active Okta users and passes each one to a helper flow.

How the flow works
- The Okta-List Users with Search card lists users with the Active status using the streaming option, passing each user to the List groups helper flow.
List groups flow
The List groups flow finds the groups for the user’s department in the table and calls a helper flow for each group.

How the flow works
- Since the main flow uses streaming, the Helper Flow sets up the Record and State fields. The Record field contains the user’s data. The flow extracts the user ID and the department directly from the Record object.
- The Table-Search Rows card searches the Department groups table for all rows where the department column equals the user’s department.
- The List-For Each card goes through the matching rows and calls the Add to group helper flow for each one, passing the group name and the user ID.
Add to group flow
The Add to group flow finds a group by its name and adds the user to it.

How the flow works
- The Helper Flow receives the Group name and the User ID from the List groups flow.
- The Okta-Search Groups card searches for the group by name and returns the ID of the first matching group.
- The Okta-Add User to Group card adds the user to the group using the group ID and the user ID.
Related Okta Workflows guides
- How to Find the JSON Object Passed From a Streaming Action to a Helper Flow in Okta Workflows
- How to Send a Notification to a Group of People Based on a Department
- Create Okta Groups from a CSV File in Okta Workflows
Okta Workflows resources
- 🚀 New to Okta Workflows? The Getting Started with Okta Workflows page has all the resources to help you get started.
- 📺 Like learning from videos? Watch Okta Workflows videos.
- ❓Have a question? Ask during community office hours or post on the community forum.
- 💬 Want to learn from the community? Join the #okta-workflows channel on the Mac Admins Slack.
- 🎓 Want to learn more about identity automation? Take the Okta Workflows training on Okta Learning.
Leave a Reply