Conditions in templates create various paths for the flow of an integration. The conditions in templates work the same way as the simple if-statement works in code. 

There can be multiple scenarios where you want to introduce a condition in a template. For example, when a trigger takes place you want to execute a set of actions when a particular condition is met. Say, when a tweet was posted you want to send a message on Slack. But you also want to send an email if the tweet contains a certain word. This can be accomplished using a condition where you use the trigger output to determine which actions to perform. 

Using conditions, two-way sync is simplified. Instead of creating multiple templates for two apps, you can combine all related templates in one template. Consequently, your end-users will need to create one integration for two-way sync instead of creating multiple integrations with the same app. 

So now you can create templates as simple as shown in figure 1 or as complex as shown in figure 2 below. Let’s see conditional logic in more detail. 

Figure 1.

Figure 2.

Every template starts with a trigger. To learn how to add a trigger or an action in a template, click here.

Note: Triggers are independent of conditions, as they take place in another app. No matter the trigger is in a condition or not, it executes anyway. 

A condition can come at any point in the creation of the template, after or before an action(s) or a trigger(s). Based on the conditions you add in If, the If-block executes if the condition is met.

The Basic Structure of the If Condition

When you click the If icon, the following form appears. 

The condition takes two operands with one operator in the middle. An operand can be variable, a hard-coded value or an attribute of the activity output. When the If Condition executes, the operation is performed on the operands. 

The operators we support are listed and explained below:

  • Equals to: True, if both operands are equal
  • Less than: True, if the left operand is less than the right operand
  • Less than or equal to: True if the left operand is less than or equal to the right operand
  • Greater than: True, if the left operand is greater than the right operand
  • Greater than or equal to: True, if the left operand is greater than or equal to the right operand
  • Not equal to: True, if the left operand is not equal to the right operand


The operands can be hard-coded values such as 1, 2, etc, a variable or a string too. However, the operands can also access the output values of triggers. When a trigger executes, the activity output is available to the template builder via Tags. 

Structure of the Operand using Activity Output

Each activity in a template is numbered, so each activity can be accessed using the object steps with its number. The figure below shows the numbering of activities. 

We use zero-based-indexing, hence the first activity is indexed 0, the second activity 1 and so on. Let’s say we want to apply the condition if (name == Integration Testing). For that add the IF Condition and in the first operand click the Add Tag button. A list of attributes of the task created in Asana will appear. Select the name attribute. The tag for the operand which is {} will be generated automatically. In the R.H.S. operand enter the string. For the operator select Equals to as shown below. The If-block will execute if the condition evaluates to true. 

You can add action, trigger or another If Condition in an If block.  Click the + icon and it will open a menu as shown below. 

The numbered icons are clickable and are explained below

  1. Adds a new action
  2. Adds a new trigger
  3. Adds a new condition. These conditions work as simple if-statement, where you specify which course of action the integration will take. For more, click here. 
  4. Closes the icon menu

Else and Else-If

When you click the If icon, an If Condition is added to the template. As a next step (outside the If block) you can add Else or Else-If statement, just like when you add an If-Else statement or an If-Else-If statement when you code. After the addition of an If Conditions the icons menu display the options of Else and Else-If, as shown below. 

  1. Adds the Else-If condition. The Else-If is constructed the same way as an If Condition. 

You can add activities and other conditions in Else If block by clicking the plus icon.

  1. Adds the Else condition

You can add activities or conditions in the Else block by clicking the plus icon. 

If the If Condition does not evaluate to TRUE, the respective Else or Else If statements are executed. 

Nested Conditions

You can add If Conditions within an If. If the outer If evaluates to be TRUE the inner Ifs will execute. A simple example is shown below. 

The flow of another template is shown below.

The template above has two If Conditions, two actions, and a trigger. The outer If contains a trigger and an action. Let’s say a “Contact was created in Active Campaign”, the action “Create Task in Accelo” will not execute. The flow of the integration will begin from the trigger and the following activities and If Conditions will be executed.

If the outer If block executes, the action in it and the inner If will also execute. The trigger will not execute.  

Note: If a trigger inside an If Condition takes place, all the activities above it will not be executed, even that If Condition will not be evaluated. 

If Conditions are introduced in templates, so you can add multiple triggers and actions in one template and execute them in the way you want. With the introduction of conditions, you can minimize the number of templates you create and add all related activities together. 

Testing an IF condition within the template

You can test the validity of an IF condition in your template by using the Test button on the right side of the step. Let’s use an example containing steps from the Pipedrive and Sendinblue apps. We have a workflow in our template like this:

The parent trigger notifies us of a person being updated in Pipedrive. The IF condition (step 1.0) in the body of the trigger checks if the email address of the updated contact is “ If this condition is true, the ‘update contact’ action (steps 1.0.0) will run for the Sendinblue app. If the condition is false, the action to create the contact (steps.1.1.0) in Sendinblue will run.

To test the IF condition, you’ll have to test the parent trigger step first of course, so that there is input data for the If condition to work with. For this example, say that you’ve already tested the trigger step, and the email address of the person that you updated is indeed “”. So the condition should be true in this example.

Once you click on the Test button for the conditional step, it will confirm the conditional statement from you one more time. Verify that and click on the Start Test button on the bottom right.

Clicking on start test will check the If condition and return you a response for the test call. If your syntax, as well as the input data for the condition is correct, you should get a success response.

Open the details of the success response to check the result of your IF condition.

As expected, our test has returned us the result “true”. So our IF condition steps should run, and the Else condition steps for this example should be discarded. This will also be shown to you by the template itself, after you test a condition out.

You can see in the above image that the non-true branch of the IF condition is greyed out. This visually indicates the path of the condition for you after you test the condition for any given set of data.

Learn about data transformation in templates.

Did this answer your question?