- 02 Mar 2022
- 2 Minutes to read
Using GoTo Step and Catch Exception to Change Flow Execution
- Updated on 02 Mar 2022
- 2 Minutes to read
Flow Execution paths can be changed by directing the path using a GoTo step to direct the path to another path or by catching Flow exceptions with the Catch Exception step.
The following example will display a Form to a user for information and direct the path to a Throw Exception step. The exception will be caught by a Catch Exception step and display an additional Form that will direct the user to continue the Flow or end Flow.
- In a Designer Project, click CREATE FLOW and select Flow. Name the Flow and click CREATE.
- Click the Done path of the Start step. Navigate to Flow, Rules, Forms, and Reports > Forms [Interaction] and select [Pick or Create Form]. Click ADD.
- On the Properties panel, click PICK OR CREATE FORM and select CREATE. Select Form, name the Form, and click CREATE.
- In the Form Designer, configure the Form to have four Text box components (To, From, Subject, Message) and a Button component (Send Email). Click Save and close the Form Designer.
- In the Properties panel, change the mapping of the input fields under the INPUTS category to Ignore.
- From the Toolbox panel, add a Send Email step from the FAVORITE STEPS category and connect it to the Send Email path of the Form step.
- On the Properties panel, click Edit Input Mappings.
- Connect each of the Form's outputs to its respective input value fields. Change the mapping of the To field to Build Array and map Item 0 to To. Click OK.
- Add a [Pick or Create Form] step from Flow, Rules, Forms and Reports > Forms [Interaction] category to the Sent path. Click PICK OR CREATE FORM, select CREATE, choose Form, and click CREATE.
- Configure the Form to have two Button components (Done, Send Another Email). Click Save and close the Form Designer.
- Attach a GoTo Step step from the FLOW MANAGEMENT category of the Toolbox panel. Connect this step to the Send Another Email path.
- Select GoTo Step. On the Properties panel, select Send Email Form from the GoToStepName field dropdown list under the SETTINGS category.
- Navigate to the FLOW MANAGEMENT > ERROR HANDLING category in the Toolbox panel, add a Throw Exception step to the workspace, and connect it to the Done path of the Send Another Email Form. On the Properties panel, enter "Exit Flow" into the Message field.
- From the ERROR HANDLING category, add a Catch Exception step onto the workspace.
- Add a [Pick or Create Form] step from Flow, Rules, Forms and Reports > Forms [Interaction] and connect it to the On Exception path.
- Create a new Form. Configure the Form with a Label (Are you sure you want to exit?) and two Button components (Yes, No). Click Save and close the Form Designer.
- Drag the Yes path to the End step.
- Attach a GoTo Step from the FLOW MANAGEMENT category to the No path of the Exception Message Form. On the Properties panel, select Send Another Email from the GoToStepName dropdown list. This will trigger the Flow to return to the Another Task [Form] upon selection of No on the Exception Message [Form] step.
- Click Save to save changes to the Flow.
- Click Debug from the top action bar.
- Click START DEBUGGING.
- Fill out the Email Form and progress through the Flow to the exception. Test both the Yes and No paths of the Catch Exception Flow.
- After testing the No path, test the Send Another Email path.