Using GoTo Step and Catch Exception to Change Flow Execution
  • 02 Nov 2022
  • 4 Minutes to read
  • Dark
    Light

Using GoTo Step and Catch Exception to Change Flow Execution

  • Dark
    Light

Article Summary

Overview

The following article demonstrates how to change Flow Execution paths by utilizing a number of different Flow steps.
 
The example below demonstrates this by placing a Form that is connected to a GoTo Step, after a Send Email step, that is configured to return to the Input Form before the Send Email step. Upon completing another Send Email task, the user then selects the Done path, sending the execution path to a Throw Exception step. The information from this Throw Exception is then "caught" by a Catch Exception step and directed to an additional Form that allows the user to either conclude the Flow or to continue to an additional GoTo Step that redirects the execution back to a previous Form.


Throw Exception 

  1. Begin in a Designer Project and click the CREATE FLOW button located on the Action Bar at the top of the screen.
  2. Select Flow, provide a Name and click CREATE.
  3. From the Flow Designer, connect a [Pick or Create Form] step from the FORMS [INTERACTION] category in the Toolbox tab on the left, to the Done path of the Start step.  
  4. With the Form step selected, in the Properties tab, click PICK OR CREATE FORM, then click the CREATE button. 
  5. Select Form, provide a Name (for this example "Send Email Form") and click CREATE.
  6. In the Form Designer, use four Labels, four Text Boxes, and a Button to design a Form to that allows a user to input the To, From, Subject, and Message fields of an Email.
    All Form controls can be added via click and drag from the Toolbox to the left of the design field. 

  7. Save the Form then close with X, to return to the Flow Designer.

  8. In the Properties for the Send Email Form Step on the right side, navigate to the INPUTS section. 

  9. Set each Input's Mapping to Ignore; doing so allows the Form to accept user input in lieu of dynamically mapped data. 

  10. From the Toolbox tab, add a Send Email step from the EMAIL category and connect it to the Send Email path of the Form step.  

  11. Click the Send Email step icon to navigate to its Properties.

  12. Click the Edit Input Mappings link and then connect each of the Form's Outputs to its respective Input as follows. Select OK to save the Mapping.

    Note that each Output's name matches the Inputs of the Send Email step with the exception of the Message Output.  Match this Output to Body. 


  13. Back in the Flow Designer, add an addition [Pick or Create Form] step from the FORMS [INTERACTION] category; connect this step to the Sent path of the Send Email step. 

  14. Click the PICK OR CREATE FORM, select CREATE, choose Form, name it "Another Task Form", then click CREATE. 

  15. Design the Form with two Buttons; one called Done and one that says Send Another Email. 

  16. Save and close the Form Designer.

  17. Back in the Flow Designer, add in a GoTo Step step from the FLOW MANAGEMENT category of the Toolbox tab.  

  18. Connect this step to the Send Another Email path. 

    To find out more about using the GoTo Step, please visit the Jumping Position in a Flow with the GoTo Step article.
  19. Select GoTo Step to navigate to its Properties tab. 

  20. From the Properties tab, select the Send Email Form [Form] step from the GoToStepName dropdown under [SETTINGS].

    This configuration ensures that the end-user will be redirected back to the 'Send Email Form' to send another email.


  21. Navigate to the ERROR HANDLING category in the Toolbox tab, add a Throw Exception step, and connect it to the Done path of the Another Task Form.

  22.  From the Properties tab of the Throw Exception step, Constant map the value "Exit Flow" into the Message Input. Notice that the Throw Exception Step does not have an outcome path, meaning there is nothing connected to the End Step just yet.


Flow Design B: Catch Exception

  1. From the same ERROR HANDLING category, add a Catch Exception into the blank canvas in the Flow Designer.

  2. Add a [Pick or Create] Form step from the FORMS [INTERACTION] category; connect the step to the On Exception path. 

  3. Select the newly added [Pick or Create] Form step to navigate to the Properties tab and click the PICK OR CREATE FORM button.

  4. Select CREATE, click on Form, provide a Name, and then select CREATE. 

  5. Design a Form with a Label component displaying the message, "Are you sure you want to exit?", and a 'Yes' and 'No' Button. Save and close the Form. 

  6. Drag the Yes path coming from the Exception Message Form to the End step. 

  7. Attach a GoTo Step from the FLOW MANAGEMENT category to the No path of the Exception Message Form. 

  8. Select the GoTo Step attached to the Exception Message Form to navigate to its Properties tab.

  9. Select the Another Task [Form] from the GoToStepName dropdown menu. This will trigger the Flow to return to the Another Task [Form] upon selection of No on the Exception Message [Form] step. 

  10. Save, then close the Flow if desired.


Debug 

  1. Click the Debug link from the top Action bar.
  2. Select the START DEBUGGING button.
  3. Fill out the Email Form and progress through the Flow.
    First out the Form and progress through the Done path to throw the exception, and test both the Yes and No paths of the Catch Exception Flow.
  4. After testing the No path, test the Send Another Email path to make sure the Flow redirects properly via the GoTo Step.  





Was this article helpful?