Overview
This article explains how to export Okta user groups to a CSV file and email it via Okta Workflows.
Solution
The automation has two flows:
- List user groups: flow lists user groups, exports them into a CSV file, and emails the file.
- 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
- The flow saves the groups into a table before exporting. The Tables-Clear Table card clears the table before each run.
- The Okta-Read User card retrieves the user information.
- 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.
- 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.
- 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.
- The Office 365 Mail-Send Email attaches the file and emails it.
Save groups to table flow
The Save groups to table flow saves user groups to a table for exporting to a CSV file.
Flow to save group information into a table.
How the flow works
- 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.
- The Text-Concatenate card combines the First name and Last name.
- 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:
Table with user group membership.
Email with group membership attachment
The automation sends the following email:
Email with group membership.
Related References
- Create Okta Groups from a CSV File in Workflows
- Save Deactivated Users, Export as CSV, and Email in Workflows
- How to Export Group Membership to a CSV File and Email the File in Workflows
- How to Write Output From the List Users Card to a CSV File in Workflows
