Export Okta User Groups to a CSV File and Email It using Okta Workflows

In this guide:

Okta Workflows guides

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 and other places. Read all the other guides.

How do you export Okta user grouops to a CSV file and email it using Okta Workflows?

This guide will teach you how to export Okta user groups to a CSV file and email it using Okta Workflows.

Export and email group membership

The automation has two flows:

  1. List user groups: flow lists user groups, exports them into a CSV file, and emails the file.
  2. Save groups to table: flow saves user groups to a table for exporting to a CSV file.

List user groups flow

The List user groups flow lists user groups, exports them to a CSV file, and emails the file.

A flow to list, export as a CSV file, and email it.

How the flow works

  1. The flow saves the groups into a table before exporting. The Tables-Clear Table card clears the table before each run.
  2. The Okta-Read User card retrieves the user information.
  3. The Okta-Get User Groups card lists all the user groups. It uses the streaming option, passing each group to a helper flow. The card also passes the static values for Username, First name, and Last name to the helper flow.
  4. After the helper flows finishes processing (saving groups into a table), the Tables-Export to CSV card exports the table data to a CSV file.
  5. The CSV file is placed into a list using the List-Construct card. The Office 365 Mail connector requires the attachment to be in a list.
  6. The Office 365 Mail-Send Email attaches the file and emails it.

List user groups flow

The Save groups to table flow saves user groups to a table for exporting to a CSV file.

Interface for a flow automation tool featuring 'Helper Flow', record creation options, and user input fields for names and identifiers.
Flow to save group information into a table.

How the flow works

  1. Since the main flow uses streaming, the Helper Flow sets up the Record and State fields. Learn how to stream records to a helper flow.
    • The Record object holds each group object passed from the main flow. In addition, the Record extracts two properties from the group JSON object: ID and Profile.Name instead of using the Object-Get or Object-Get Multiple card.
    • The State object holds three static values passed from the main flow.
  2. The Text-Concatenate card combines the First name and Last name.
  3. The Tables-Create Row card creates a row in a table with the following information:
    • Username
    • Full name
    • Group ID
    • Group name

The table after running the automation:

User groups table interface displaying columns for rowId, updated, Username, Full name, Group ID, and Group name.
Table with user group membership.

Email with group membership attachment

The automation sends the following email:

Email with group membership.
Email with group membership.

Okta Workflows resource

🚀 New to Okta Workflows? The How to Get Started with Okta Workflows page has straighforward steps to help you get started.

📺 Like learning from videos? Watch Okta Workflows videos.

❓Have a question? Ask during community office hours, post on the community forum, or email me.

🙋🏻‍♀️ Want to learn from the community? Join the #okta-workflows channel on the Mac Admins Slack.

📖 Want to learn more about Okta and automation? Take the Okta Workflows training on Okta Learning.

Leave a Reply

Discover more from Max Katz

Subscribe now to keep reading and get access to the full archive.

Continue reading