Formulas: Conditional Logic
Brian Holthouse avatar
Written by Brian Holthouse
Updated over a week ago

It is also important to create recipes that are resilient against unexpected scenarios. For example, your trigger data might contain missing values or contain a data of another datatype.

You can use conditional logic to prepare your recipes for these situations.


You can conditionally execute formulas using Ruby's ternary syntax (popular shortcut for if-else statements). Ternary syntax are of the form:

condition ? expression1 : expression2


  • A boolean expression that evaluates as true or false.


  • Returns this value if condition is true.


  • Returns this value if condition is false.

Example: Using first name or full name

In the following example, we conditionally pass in either the datapill [Full Name] or [First Name] into the Message input field.

Ternary syntax

Here is a detailed explanation of what the ternary formula does:

  • [Full Name].present? will check if the [Full Name] pill has a value . If it has a value, it evaluates to true. If it has no value, it evaluates to false.

  • The second '?' in the formula separates the condition to evaluate from the expressions to return. Note, the first '?' is part of the .present? formula whilst the second '?' is separated with a space character and is part of the ternary syntax.

  • If there is a value in the [Full Name] pill when the job is ran, the value for Full name will mapped to the Message input.

  • If there is no value in the [Full Name] pill when the job is ran, the value for First name will be mapped to the Message input. Of course, if there's also no value in this First name pill, the job will fail at this step if Message is a required input field.

For more information on Ruby's ternary syntax, check out this article

Example: Skip field if empty

When updating records, you want to preserve existing data while changing only the updated fields. In this situation, can you use the 'skip' formula to instruct the action to leave this field untouched.

This example attempts to use an updated Salesforce record to update a field titled 'Company Name.

This checks if [Company] is present, and then outputs [Company] if it is present, otherwise, leaves this field untouched.

Did this answer your question?