Okta Workflows How-To: Sending Automatic Emails to Groups Based on Employee Department
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?
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:
The flow uses a table to hold department emails and looks like this:
How the flow works
- 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.
- The second card Tables – Search Rows retrieves all emails associated with the particular department.
- 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.
- 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.