Learn how to use an “If” node in an App Connect flow to perform different actions depending on the data that it receives from applications in your flow.
You add an If node to a flow when you want to do some conditional processing. For example, when someone signs up to one event, you might want to add them to a mailing list; but if they sign up to another event, you might want to add them to your marketing application. Or you can use an If node to make decisions based on a response code for a previous action. Say you’ve added an “update or create” action to your flow. You might want to take different actions depending on whether a record was updated or a new one was created.
Things to consider when using an If node:
- You can add up to 10 If nodes to a flow.
- A single If node can have multiple branches.
- If you add an action after an If node in a flow, you can choose to exit the flow at the end of as many branches of the If node as you like, as long as at least one branch continues processing so that data is passed to the target application. If the If node is at the end of an event-driven flow, the flow can exit on all branches.
- If you exit the flow at the end of a branch, you cannot define output data for that branch.
- When both sides of a condition look like numbers (for example, “if 2 is less than 10”), the values are treated as numbers. But if one side can’t be treated as a number (for example, “if 2GB is less than 10GB”), both sides of the condition are converted to strings and compared.
- Including spaces in your condition values affects comparisons. For example, “2 ” (a number followed by a space) is not the same as “2”.
You can handle complex processing by adding more actions to your IF and ELSE branches or by adding more conditions. You can also add nested If nodes by adding more If nodes to branches.
Adding and configuring If conditions
First, find or create everything you need:
- An App Connect subscription.
- The user names and passwords for the accounts that you want to access (if you haven’t already connected App Connect to your accounts).
You can connect to your accounts now on the the Applications tab on the App Connect Catalog page, or you can connect as you add each application to your flow.
Some applications need some extra information to be able to connect to App Connect; if you need help finding this info, see “How to” guides for apps.
Next, create your flow:
(App Connect automatically saves your changes as you go. If you move away from the flow at any point, the flow is saved as a draft flow that you can come back to later.)
- Log in to App Connect.
- From the Dashboard, click New > Event-driven flow. (You can also include an If node in a flow for an API, but this tutorial will assume that you’re creating an event-driven flow.)
- Enter a name that identifies the purpose of your flow.
- Select your first application (source), then select the event that’ll trigger the actions in the rest of your flow.
For some trigger events, you might have to provide some info, like the name of an event or list that you’re expecting to be updated.
- Select a target application, then add a suitable action to your flow.
- Configure your target application in the usual way, mapping the data that you want to transfer from your source application.
- Click the plus (+) to add another node to your flow, open the Toolbox tab, and select If (conditional).
- Define your first If condition by selecting a field from the source application, choosing an operation, and, if appropriate, setting a value.
- (Optional) To add another If condition, click Add condition. Define it in the same way as your first condition, and choose whether both conditions have to be matched, or just one of them by selecting All of the following are true or Any of the following are true.
- Add a target application for your “if” branch by clicking the plus icon, and select the action to be performed. You can add more target applications in the same way.
- (Optional) Add one or more “else if” branches by clicking Add else if and defining one or more conditions.
Tip: When you add conditional logic to a flow, data will travel down the first branch where the conditions are matched. So pay close attention to the order of your branches. Also, target applications (and nested If nodes) on a branch of an If node can only see data from the preceding actions in the branch; they can’t see data from other branches.
- (Optional) Add one or more target applications for your “else” branch and, if added, your “else if” branches.
Here’s an example of a completed If node: In this example, the If node follows an “update or create” action in Salesforce. If the Salesforce action resulted in a status code of 200, that means that a record was updated, so the flow will create a task in an Asana project called “Promotion for existing customers”. But if the status code indicates that a new record was created, the flow creates a task in an Asana project called “Promotion for new customers”.
- (Optional) If you want to pass the data from the actions in your If node to the rest of the flow, create an output schema and populate the output data for each branch.
- Expand the Output schema section and click Add a property.
- Enter the name of a piece of data that you want to pass to the rest of the flow, such as Email Address or Last Name.
- If the property is mandatory in the output data, select Required.
- Repeat these steps to add as many properties as you need.
- For each “if” and “else” branch, click Output data and populate the fields from the output schema with the data that you want to pass to the rest of the flow.
- (Optional) If you want to exit the flow for a particular condition, select Exit flow at the end of this branch. Select the message code that you want to be written to the logs, and write your own message to accompany it. (Your message can be a maximum of 128 characters long.)
- (Optional) Add one or more target applications and actions after the If node. Youâ€™ll see that when you come to populate the target fields for these actions, you can map data from the source application, as well as from any preceding If nodes and actions.
- To start the flow, open the options menu [⋮] in the banner and click Start flow. Then click Dashboard to exit the flow.
Creating an event-driven flow that updates or creates a contact in Salesforce and updates Asana whenever you receive a form in Wufoo
Learn how to use App Connect to connect Wufoo to Salesforce and Asana so that every time someone submits a completed change of address form in Wufoo, a Salesforce contact is updated or created, and, according to the Salesforce action, a task is added to the appropriate project in Asana.