How to Setup an Error Notification Flow in Okta Workflows
Last Updated:
Overview
Okta Workflows allows administrators to create a reusable Helper Flow that other flows call to send error notifications when a flow execution error occurs. Configure an If Error card to catch execution errors and trigger the Helper Flow to alert the appropriate channels.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Workflows
Solution
What is the process to create the reusable Helper Flow for error notifications?
Create a new flow, add a Helper Flow event card, configure a communication connector, and map the message input to the connector text field.
- Create a new flow in any folder (recommended to create a folder called "Utilities" to store Helper Flows that will be used frequently).
- Add a Helper Flow event card to the flow and create an input of data type text called "message".
- Add the Slack connector Send Message to Channel action card to send the error notification message. Note that it is possible to use another application connector or function, such as Gmail, Office 365 Mail, and so on, to send out the error notification.
- After configuring the Send Message to Channel card, drag the "message" input value from the Helper Flow card to the Slack Send Message to Channel card "Text" input:
- Save the flow and turn it on.
Configure a flow to call the Helper Flow when an error occurs on specific cards.
Create a new flow (or use an existing one), add an If Error function card, configure the Try and If Error blocks, and pass the error message to the Helper Flow.
- Create a new flow and add an If Error function card. This card looks like a container and has a dropdown near the top where Try and If Error can be selected.
- Select Try, and add the actions and functions to be executed.
- Workflows will attempt to execute the cards within the Try block.
- If an error occurs, the card will execute the cards within the If Error block.
- Select If Error, and add the following cards within the block:
- Flow Control- Assign card
- Text - Compose card
- Flow Control - Call Flow card
- In the Assign card
- Create an input named "workflowsBaseUrl" and set it to the Okta org base URL.
- Create another input named "flowId" and set it to the ID of the current flow, which can be copied from the end of the URL in the browser address bar. For example:
- In the Text - Compose card, build out the error message with a link to the execution history of the flow that failed
- Use the 'workflowsBaseUrl' and "flowId" inputs from the Assign card and the "execution" and "message" fields from Error object to build the history link as seen in the screenshot below.
- In the Call Flow card, select the Helper Flow created earlier, and drag the "Error Message Notification" output from the Compose card into the "message" input on the Call Flow card:
- Select Try, and add the actions and functions to be executed.
- Save the flow and turn it on.
How is the error notification flow tested?
Add a Read User card with an invalid value to the Try block to generate an error and trigger the If Error block.
- To test the flow, add a Read User card in the Try block of the If Error card and set the "ID or Login" input to an invalid value. This will generate an error, and the "If Error" block of the If Error card will be executed to call the Helper flow and send the notification:
