If Condition
Harness your workflows with the business logic of If Condition to ensure that automations execute only when a specific condition is met. This avoids a user getting results for every trigger event.
If Condition acts as a gateway where a journey executes successfully only when a specified condition is met. The output received from the trigger and previous action(s) is checked thoroughly by If Condition and then it's passed to the actions downstream. In case the condition is not satisfied, If Condition doesn't execute the actions configured in the If block.
You can use If Condition between a trigger and action or action and action, depending on your use case.
Let's consider a business use case to understand If Condition in a more realistic way.
Use case
Fetch a new email in Gmail and send it to another email via Gmail if the subject of the received email contains the word, Demo. In this use case, we will use the Contains
condition.
Trigger: Gmail-Get email
Condition: If Condition as a business logic with
Contains
as a conditionAction: Gmail - Send email
Prerequisites
Before configuring a journey, create a Google Workspace account to have an official Gmail account ready to implement the use case.
Quickwork supports two types of Gmail connectors:
Gmail: This connector is used to connect the official Google Workspace account with Quickwork and perform the tasks accordingly. It requires authorization to establish the connection.
Gmail Secondary: This connector is used to connect a personal Gmail account with Quickwork and perform the tasks accordingly. It requires authentication (client ID and client secret) to establish the connection.
Configuring a trigger
To configure a Gmail trigger, follow these steps:
Under the Event section, search for the Gmail app and click on it.
Then select the trigger event, Get email, from the Triggers list.
Authorize Gmail by selecting an existing connection from the drop-down or creating a new connection.
Select the label INBOX from the drop-down menu in the Label field:
Configuring the If Condition
Now, let's use the If Condition feature. Under the Steps section, click the Business Logic option and select If Condition:
2. The Setup If condition block will appear with a pre-indented action bar as illustrated here:
You will get the following fields to which input is to be specified:
Specify a value in the Left Value field by placing the
Subject
data pill from the Gmail | Get email Trigger-Data Tree Output on the right-hand side of the screen.
The Left Value field acts as an input to the If Condition. The input of this field is the output of the trigger or previous actions used.
2. Select the Contains
condition from the drop-down in the Condition field.
3. Specify the Demo keyword as the value in the Right Value field.
An input provided in the Right Value field is a keyword satisfying the condition. It can be a string, integer, date, or timestamp.
You can add OR and AND conditions between 2 or more If Conditions by clicking the Add condition button. It creates a nested If Condition that can handle severe complexities within a journey.
Configure the Gmail action
The following fields will open up in which you need to enter the details:
To (required): Enter the email ID of the recipient to whom you want to send an email. E.g., johndoe@gmail.com.
Subject (required): Enter the subject of the email you want to send
Message (required): Enter the email in rich format text you want to send. The entire email message field is RFC 2822 formatted and supports the base64url writable encoded string. You can also drag and drop the Body as HTML data pill from the output of the Get email trigger under the Data Tree Output.
There are some optional fields such as Cc, Bcc, Attachments, etc. to which you can specify the URL of the file and its name that you want to send with the email.
The Gmail to Gmail journey looks like the following screenshot after completing the configuration:
The journey is now configured successfully. Click the Save changes button and start the journey. Whenever the Gmail trigger fetches a new email, If Condition will check the subject line for the word Demo. If the condition gets satisfied, an email will be sent to the email ID(s) specified in the Gmail action. Else the journey will terminate.
Types of conditions
Let's take a tour of If Conditions that Quickwork offers: Points to remember:
All the conditions are case sensitive and support all the data types as an input and output value
Equals The Left Value field (input) equals a value specified in the Right Value field (output).
Example:
Condition: Equals
Right Value: 5
Note: In the case of the string data type, the comparison is made based on the ASCII value.
Does not contain The Left Value (input) field should not contain a keyword in the text specified in the Right Value field (output).
Example:
Condition: Does not contain
Right Value: Sample
Does not equal The Left Value (input) field input should not be equal to the value specified in the Right Value field (output).
Example:
Condition: Does not equal
Right Value: 15
Starts with The Left Value (input) field input should start with a keyword specified in the Right Value field (output).
Example:
Condition: Starts with
Right Value: Demo
Does not start with The Left Value field (input) should not start with a keyword specified in the Right Value field (output).
Example:
Condition: Does not start with
Right Value: Sample
Ends with The Left Value field (input) should end with a keyword specified in the Right Value field (output).
Example:
Condition: Ends with
Right Value: Journey
Does not end with The Left Value field (input) should not end with a keyword specified in the Right Value field (output).
Example:
Left Value: Let's say the value of this is Demo Journey.
Condition: Does not end with
Right Value: Sample
Greater than The Left Value field (input) should be greater than a value specified in the Right Value field (output).
Example:
Condition: Greater than
Right Value: 2
Note: In the case of the string data type, the comparison is done on the basis of the ASCII value.
Greater than equal to The Left Value field (input) should be greater than or equal to a value specified in the Right Value field (output).
Example:
Condition: Greater than equal to
Right Value: 6
Note: In the case of the string data type, the comparison is based on the ASCII value.
Less than The Left Value field (input) should be less than a value specified in the Right Value field (output).
Example:
Condition: Less than
Right Value: 5
Note: In the case of the string data type, the comparison is done on the basis of the ASCII value.
Less than equal to The Left Value field (input) should be less than or equal to a value specified in the Right Value field (output).
Example:
Condition: Less than
Right Value: 5
Note: In the case of the string data type, the comparison is done on the basis of the ASCII value.
Is true The Left Value field (input) should be true. In this case, you don't need to specify the value in the Right Value field.
Example:
Condition: Is true
Is not true The Left Value field (input) should not be true. In this case, you don't need to specify the value in the Right Value field.
Example:
Condition: Is not true
Is present The Left Value field (input) should be present. In this case, you don't need to specify the value in the Right Value field.
Example:
Condition: Is present
Is not present The Left Value field (input) should not be present. In this case, you don't need to specify the value in the Right Value field.
Example:
Condition: Is not present
Last updated