If-Then steps
An If-Then step runs nested steps when a given condition. The nested steps only run if the specified event occurs, otherwise the If-Then step is skipped and the flow continues. For example, you can create an If-Then step that captures the email field on a Formstack form; checks that the email isn't a personal address ending with @gmail.com, @yahoo.com, or @hotmail.com; and if not, adds the email to a Mailchimp list.
-
In a flow step, choose If-Then from the menu.
-
Choose the step data object for the If statement.
-
Choose a condition to be met.
See Conditions table below for possible conditions. -
Enter a value or choose a step data object.
-
(Optional) Continue to add AND or OR statements.
-
Click Save.
-
In the If step, choose Rename from the menu, enter a description, then click Rename.
Conditions
Text | Number | Date | Boolean | Other |
---|---|---|---|---|
|
|
|
|
|
Example 1
Below is an example of how to use an If-Then step in a flow, using the Formstack to Mailchimp scenario described at the top of the page.
-
In a project, create a new flow and name it New subscriber on new form entry.
-
Choose the Formstack connector from the list of connectors, choose the New form submission trigger, then click Continue.
-
Connect your Formstack account, then click Continue.
-
Choose the form you want to use from the list, test the trigger by submitting a test submission, then click Save Trigger.
-
From the New form submission step, choose If-Then from the menu.
-
In the lefthand field, choose the Email step data block from the New form submission step.
-
In the middle field, choose Text: Includes Case-Sensitive from the list of conditions.
-
In the righthand field, enter '@gmail.com'
-
Add two OR statements by clicking + Add OR Statement twice.
-
Use the same step data and condition as before, then enter '@yahoo.com' into the righthand field of the second statement and '@hotmail.com' into the righthand field of the third statement.
-
Click Save.
-
From the If step, add a new action step from the menu.
Here, you see two different places to add the step. Adding the action as a step nested within the If step will cause the action to be performed when the condition is true. Adding the action as a step outside of the If step will cause it to be performed as normal in the flow. In this example, we want to add the step outside of the If step so that it runs as normal. In other words, when Email contains any of the text specified in the three statements (@gmail.com, @yahoo.com, or @hotmail.com), the condition is true, but, because there is no nested substep in the If step, no action will be performed. So, to add emails that don't contain the specified text to the mailing list, the Mailchimp action should be placed outside of the If step so that it's performed as it normally would be, irrespective of the conditions specified in the If step.
-
Click Execute Action when condition is false, choose the Mailchimp connector, choose the Subscribe to audience action, then click Continue.
-
Connect your Mailchimp account, then click Continue.
-
In the Audience field, choose an audience from the list.
-
Next to the Email field, click , then choose the Email step data block from the New form submission step.
-
Configure other fields as necessary, then click Save.
-
Finally, click the toggle above the flow to enable it.
Now, when a user submits the specified Formstack form where the Email field does not contain @gmail.com, @yahoo.com, or @hotmail.com, the user will be added to the chosen Mailchimp audience.
Notes
-
If-Then steps only apply to a single condition, with one or more statements, and do not function like
else if
loops in programming languages like Python or JavaScript. For multiple conditions, use multiple If-Then steps.