You can add a start condition to a block if you want to ensure that a block only runs if certain conditions are met.
This can be useful if, for example, you want to send a different Slack notification or email message depending on the output of a previous block.
To use a start condition for a block, hit the ⏩ icon in the upper-right corner of any block.
You'll see a field where you can express a condition using
example, we're evaluating the length of the query results from a prior SQL block. If no rows were
returned, then this start condition will evaluate to
true and output a message in Slack.
When a block's start condition evaluates to
true it will execute normally. If it evaluates to
false, it will be skipped.
To remove a start condition, click the ⏩ icon again.
Evaluating the "else" from a start condition
If you also want to cover the case where the conditional evaluates to
false, just create another
block with the opposite start condition (e.g.
lookup.output.Q1.length > 0 in the above example).
Whenever a block's start condition evaluates to
false, that block is skipped and the next block is
Multiple blocks with the same condition
Sometimes, you might want more than one step to execute if a start condition is met. For example,
let's say that you have a runbook that deletes a user account. The runbook has a boolean parameter
that asks whether or not the user wants an exported archive of all their data. If this parameter is
true, then you want to execute a task block that generates the archive, and then an email
block that sends that user a link to the archive.
In this case, you need to add the same start condition to all blocks that you want to execute in this "branch" of your runbook.
Conditional user confirmations
Start conditions can be paired with manual blocks to conditionally request a user confirmation before continuing. For more information, see Manual blocks.