Built.io Blog

Add Conditional Logic To Your Workflows Using Filters

,

Sometimes when you are building a workflow, you may only want an action to run when one condition is—or multiple conditions are—met. For example, say you want to send a Cisco Spark notification when an incoming email contains certain keywords. You can achieve this by using workflow filters.

Filters let you add conditions in your workflow. They let you define ‘proceed only if’ statements, which essentially mean that the workflow will only execute if the defined conditions are met. Workflow filters help you eliminate unnecessary workflow executions, allow you to filter out clutter, and better specify the data or information you want to receive.

Now, let us look at different ways in which we can apply filters!

Two Ways To Use Workflow Filters

1. Apply filters to a trigger.

Let’s say you want to get an email for each new note in your Evernote account only if the note contains the word ‘Important’ in the title.

To do this, set up a workflow with the following trigger and action:

Trigger: Evernote - New Note
Action: Gmail - Send an Email

The trigger initiates whenever a new note is created in Evernote, and the action will deliver a message to an email account you specify. In this how-to, we will use ‘Gmail.’

How to configure your trigger

trigger-configuration.png

Configure the trigger and then click the ‘Filters’ option on the left. Click on the ‘+ Add Filters’ button to add filters to your workflow.

When the ‘Filter’ screen appears, specify your conditions by filling in the ‘Input’, ‘Condition’, and ‘Expected’ fields.

Use the following to set up these fields:

Input: Title

Since you want to apply a filter in the title of the new note, select ‘Title’ from the drop-down list.

Condition: Contains

The condition field consists of many conditional operators. The ‘contains’ operator checks whether the title contains the word in the ‘Expected’ field.

Expected: Important

In this field, you need to specify the expected value. In this case, we will use ‘Important’ as the expected value because you want to receive an email if the title contains ‘Important’.

After the configuration, your workflow should look like this:

trigger-workflow.png

Under ‘Action’, add the email account where you want to be notified. Click here to learn how to add actions.

Save your workflow. For good measure, we recommend you test this by creating a note in Evernote; remember to include ‘Important’ in the title.

2. Apply filters between an action and a trigger, or between two actions.

Let’s assume that you want to post a message to Cisco Spark for new incoming emails only if the subject contains the phrase ‘Built.io Flow’.

To do this, set up a workflow with the following trigger and action:

Trigger: Gmail - New Mail
Action: Cisco Spark - Post New Message

After the configuration, your workflow should look like this:

filtered-workflow.png

Click on the filter icon beside the ‘Gmail’ logo.

Specify your conditions by filling in the ‘Input’, ‘Condition’, and ‘Expected’ fields.

Use the following to set up these fields:

Input: Subject

Since you want to apply the filter to the subject, select the ‘Subject’ value from the drop-down list.

Condition: (Text) Contains

The ‘contains’ operator checks whether the input data in ‘Subject’ contains the word specified in the ‘Expected’ field.

Expected: Built.io Flow

In this example, you should use ‘Built.io Flow’ as the expected value because you want to be notified only if the subject contains this phrase.

workflow-conditions.png

Under ‘Action’ configuration, add the Cisco Spark account where you want to be notified. Click here to learn how to add actions.

Save your workflow. For good measure, we recommend you test this by sending yourself an email—remember to include ‘Built.io Flow’ in the subject—to ensure that the workflow runs properly.

Give it a try!

To learn more about filters, click here.

To learn more about how to use different types of conditional operators for your filters, click here.

Popular Posts

Subscribe to our blog