Open Navigation

Conditional Logic

On This Page

Conditional logic is a powerful feature of the workflow builder. It enables you to build intelligent workflows that only run steps under certain conditions. For example you might want to:

  • Only sync Intercom users to Salesforce if they match a particular segment
  • Send a message to a different Slack channel based on a form's input

Tray has two key helpers that help you do this: the "boolean condition", and the "branch" connector. Most of the time, you'll want to use the boolean condition.

Setting up conditional logic using the boolean condition

Here's how to set up a workflow that checks to see if a Slack channel exists or not, and then send a different message based on the result.

  1. Create a new workflow, using a manual trigger.

  2. Add a Slack connector, and choose the "Channel Exists?" operation. Type a channel name that does exist for now:


  3. Add a boolean condition connector to the workflow, and pass the "exists" property from Slack to the 1st Value property in the boolean condition.


  4. Change the type of the "2nd Value" property to "boolean"


    Ensure that the checkbox is checked. (This means that it is "true").


Note: we've changed the type of the "2nd Value" to a "boolean" type because the type of the "exists" property coming from Slack is also a boolean.

  1. Add a Slack connector to the "TRUE" branch, to send you a message indicating that the channel exists in Slack.


  2. Click 'Run workflow now' - you should see a message appearing in Slack!

  3. Add another Slack connector to the "FALSE" branch, to send you a message indicating the channel doesn't exist:


  4. Change the channel name in the first Slack step you added (the one to check if the channel exists) to a channel that doesn't exist.


  5. Run the workflow again - you should see the message from the FALSE branch this time!

Was this article helpful?
On This Page