Flow Control Blocks

Concept

Flow control blocks give you the possibility to make certain parts of your flow conditional. This allows you to build a flow that does different things depending on the input it gets.

For instance, the following screenshot shows a Condition block. If the condition is true, the document will be e-mailed; if the condition is false, the document will be sent to DocuSign and a note will be created.

You can also nest flow control blocks:

Lanes

Every flow control block has one or more lanes, which are possible pathways the flow will take.

For instance, the Condition block starts with two lanes, each with one zone:

A Condition block can only have 2 lanes, but a Switch block can have as many lanes as you like:

A lane can also have as many zones as you like.

Types of flow control blocks

There are 3 flow control blocks:

  • Condition
  • Switch
  • Try/catch

Condition

Condition is used when you want to execute one lane or the other, based on a condition you define yourself.

For instance: when the Employees field in my data set is...

  • ...greater than 10, execute the True lane.
  • ...not greater than 10, execute the False lane.

Switch

Switch is used when you want to check one field against multiple values, and execute the lane that is associated with that value.

For instance: when the Department field in my data set equals...

  • ...Marketing, execute Lane A.
  • ...Sales, execute Lane B.
  • ...Operations, execute Lane C.
  • ...something else, execute the Default lane.

Try/catch

Try/catch is used when you're not sure a block will execute successfully, and you want the flow to keep running even though something went wrong.

Flows will always stop when a block returns an error, except when that block is inside the Try lane of the Try/catch block.

Linking to flow control blocks

The main rule of flows still applies: you can only link blocks from different zones. This is also true within a flow control block. But there are 2 additional rules.

You cannot link directly to blocks inside a flow control block from a block that comes after the flow control block

That sentence has the word 'block' in it 4 times. Let's clarify this with an example:

The Generate document block is linked to the Retrieve data block that comes before it, BUT you cannot link the Send e-mail block to the Generate document block, because Generate document is inside Condition A.

This is because a flow cannot know beforehand which lane (of the condition) will be used. Imagine Condition A being true - what would happen with Send e-mail if it was linked to a block that wasn't even executed? That's why this rule was put in place.

So how do we do something with the generated document in this scenario? This brings us to the second rule for linking flow control blocks.

A block's output is added to the control block's output if every lane contains that same block exactly once

If you want to use the output of a block (that's inside a flow control block) in blocks that come after the flow control block, that block has to be in every lane of the flow control block EXACTLY ONCE.

Using the example above, in order to use the generated document in the e-mail, we need to configure it like this:

Now we can link Send e-mail to Condition A's generated document:

This is possible because there is exactly one Generate document in every lane of the flow control block. You can add other blocks, like Send e-mail C in the screenshot below, but remember that its output will only be available in the Condition A block's output if you also add a Send e-mail block to the other lanes.

You can add more Generate document blocks, but this introduces conflict. If there were more copies of the same block in one lane, the flow would not know which to use. Such a scenario won't work:

Send e-mail throws an error because it is linked to Condition A, but we put that link in place when Generate document X did not exist yet. Now that we added Generate document X, the flow is no longer valid since there is not exactly one Generate document block in each lane.