Okta Workflows How-To: Sending Automatic Emails to Groups Based on Employee Department

Okta Workflows is a no-code platform for automating identity processes. The Workflows team holds weekly office hours where they answer builder questions.

This blog post is based on a question asked during office hours: How can I use Okta Workflows to automatically send an email to a specific department when a new employee is onboarded to that department?

Getting started

Through Okta Workflows, you can set up automatic email notifications for specific groups when a specified trigger takes place: For example, when a new employee is onboarded. You can specify who should be alerted based on criteria like the department that employee has joined, and can even choose to alert multiple groups of people at once.

For example, if a new employee is joining the Engineering department, you may want a message to go to 3 email aliases: the new employee, [email protected], and [email protected]. Or if a new employee joins  the Marketing department, you may want an email to go to that person, plus a copy to [email protected], and so on.

Here is a flow to do that:

Send email based on department

The flow uses a table to hold department emails and looks like this:

Department emails table

How the flow works

  1. The first card On Demand – Helper Flow makes this a helper flow. The helper flow has two inputs: Department and Primary email. A helper flow can be reused with other flows.
  2. The second card Tables – Search Rows retrieves all emails associated with the particular department.
  3. The result from Tables – Search Rows is a JSON object with five key/value pairs. The List – Pluck card removes (plucks) all key/value pairs except the one specified in the key input (Email). After this step you have a list of email(s) to copy.
  4. The last card Gmail – Send Email sends an email to the person who was onboarded (Primary email) and one or more department groups are copied (CC input) on the email.

Get your Workflows questions answered

Have a question about Okta Workflows? Not sure how to build a flow? Join the weekly community office hours to get help.