Tray Platform / Standard/Best Practices / Conditional Logic

Conditional Logic

Conditional logic is a powerful feature of the workflow editor. It can be used to ask key questions whose answers will then determine what path your workflow will take.

Tray has two key conditional logic connectors:

  • The Boolean Condition connector can ask simple true/false questions such as 'did the new customer opt-in to marketing?' or 'is it more than 3 months since we last contacted this person?'

  • The Branch connector can be used to set multiple pathways depending on multiple different outcomes being picked up from your data. For example you may receive support tickets of 3 or 4 different types and want to set paths for each one to notify the relevant people to take appropriate action.


Two simple examples are given for each connector in their respective docs pages, linked to above.

Another good example is found in the Recurly tutorial on finding inactive accounts:


This loops through each individual account and the boolean step checks if its state is 'inactive':


Some further examples of the Boolean Condition connector being used can be found in the Updating missing customer info tutorial. This tutorial gives full instructions on how each boolean step is configured. Below is a summary of what some of the boolean steps are achieving.

One of the things the boolean condition is used for here is to check if a contract exists in Salesforce by using the Boolean Property Exists? operation (in this case the Salesforce Get contract step will only return an ID if it has actually found a contract):


If a contract is found it then checks if it has an entry for a particular field (in this case it is checking if the 'StripeID' custom field is 'null' and then updating the contract with the ID pulled from Stripe if the query returns 'true'):


Another thing it is used for is to check if there are more customers left from the Stripe 'List Customers' operation - making use of the Stripe has_more value which is returned with the 'List Customers' operation.

In this case if the result is False we end the process of looping through customers with the Break Loop connector: