This article discusses using a Condition action to branch a Workflow.
To ensure that the concept of Branching is clearly understood, this article takes the form of a tutorial on using a Condition action in a Workflow. You can then run the Workflow on the User Application and see how branching occurs depending on the path of the Condition action.
Table of Contents
To fully understand this article, we recommend reading the following articles first:
What are Conditions?
Conditions allow users to branch a workflow, allowing the workflow to go down different paths.
The Condition action comprises one (1) or more IF statements and an ELSE statement, with the Workflow branching into two paths, depending on which the of the statements meets the condition.
In a Condition action with a single IF statement, if the action meets the condition in the IF statement, it will branch into the path of the Workflow covered by the statement; if it meets the condition in the ELSE statement, it branches into the other path of the Workflow instead.
A Condition action with one If statement and an ELSE statement can be summarized as follows:
If Statement 1, GOTO Action 1
GOTO Action 2
In a Condition action with two IF statements, the action must meet all the conditions in an IF statement before it branches into the path covered by this IF statements. For multiple IF statements, the order in which they are arranged in the Action Editor matters. AUTTO goes through the first IF statement, then the next one until it reaches the last one. The workflow will branch down the first IF statement that meets all the conditions and will not consider any subsequent statements.
A Condition action with two or more IF statements can be summarized as follows:
If Statement 1,
... (this denotes that you can add as many If statements if needed)
If Statement n, GOTO Action 1
Using a Condition to Branch a Workflow
Let's demonstrate the use of a Condition action in branching a Workflow.
For our purposes, we will create a Workflow that sends a different non-disclosure agreement (NDA) based on whether a Contractor is a Company or a Freelancer.
Before we start, create two documents that you will use as the Contractor and Freelancer NDAs. Name these documents as Company NDA and Freelancer NDA, respectively. These documents can either be in PDF or .Docx formats.
In addition, create two Form actions and name them Company Questions and Freelancer Questions, respectively. The Company Questions form should at least have the company name, the company's signatory, and contact email address saved into square brackets. The Freelancer Questions from should at least have the freelancer's name and contact email address saved into square brackets.
Let us now start designing our Workflow:
- Create a Workflow (see Creating a Workflow for more information) and name it NDA.
- Set up the Start action, entering a headline and any welcome text you like.
- Add a Form action to the workflow, and add a Text question and a Multiple Choice question to the Form.
For the Text question, ask the user the date of the NDA, e.g. What is the date of the agreement?
For the Multiple Choice question, ask the user to select the contractor type from the available options, add Company or Freelancer as the choices, and add contractor_type as a square bracket.
The completed Form action is shown below.
NOTE: Make sure to mark the Text and Multiple Choice questions as compulsory.
- Add a Condition action to the Workflow, connect it to the Form action we added in Step 3 above, then open it for editing.
- Click the If section and select [contractor_type] from the available operators (these include the square brackets we created in Step 3).
Once you select [contractor_type], more operators appear. Select the IS operator, then Select input, then choose Company.
Finally, select GOTO, then select the Company Questions form you created prior to starting this exercise.
- Under the Else section of the Condition action, select GOTO, then select the Freelancer Questions form you created prior to starting this exercise.
- Our workflow now looks like the screenshot below, with the two Forms now positioned below the Condition action.
- Let's now add two AuttoDoc actions to the workflow, link them with the Company Questions and Freelancer Questions actions we set up in Step 7, and open them for editing.
- Name the AuttoDoc linked to the Company Questions form as Company NDA and the other AuttoDoc as Freelancer NDA. Then upload the two NDA documents we created prior to starting this exercise. The screenshot below shows how an AuttoDoc looks before we upload a document to it.
An AuttoDoc with an attached document is shown in the screenshot below.
- Let's now add two Email actions to our Workflow. Link one Email action to the Company NDA AuttoDoc we created in Step 9. Link the other Email action to the Freelancer NDA AuttoDoc. Then edit the Email actions, using the square brackets you use in the Company Questions and Freelancer Questions forms when appropriate. The screenshot below shows how the Email action for the Company NDA should look like.
- The Workflow should look like the following when you have set up the Email actions.
Preview the Workflow to check how it works. The Workflow should send an email with the Company NDA attached when the Contractor is a company, and the Freelancer NDA when the Contractor is a freelancer. You may publish the Workflow when you are satisfied with how it works.