No history yet

Advanced Routing and Logic

Beyond the Straight Line

So far, you've likely built workflows that move in a straight line from a trigger to a final action. This is great for simple tasks, but reality is rarely that neat. What if you need your workflow to make decisions? Or what if you need to handle a whole list of items, not just one?

Simple, linear scenarios can't handle these complexities. To build truly powerful automations, you need tools that can create branches, handle multiple items, and bring everything back together. Let's explore how to manage these more complex data flows.

The Router: Your Workflow's Traffic Cop

Think of a Router as a fork in the road for your data. It takes the single bundle of information coming in and allows you to send it down multiple paths simultaneously. By itself, this is useful, but its real power comes alive when you add filters to its paths.

By placing a filter on a route, you tell your scenario to only let data pass if it meets a specific condition. This is how you create if/then logic. One path might handle one condition, while another path handles a different one. You can even create a fallback path that catches any data that doesn't meet the other conditions.

For example, imagine a workflow triggered by new emails. You could use a Router to check the email's subject.

  • Path 1 Filter: If the subject contains "Invoice", the workflow sends the attachment to your accounting software.
  • Path 2 Filter: If the subject contains "Urgent", it sends a notification to your Slack channel.
  • Fallback Path: If neither condition is met, the email is simply archived.

Handling Items in Bulk

Sometimes a module doesn't output just one thing; it outputs a collection of them. For instance, a module might fetch all the rows from a spreadsheet or all the files attached to an email. This collection of items is called an array.

If you connect a standard module to an array, it will only process the first item in the collection and ignore the rest. To work with every single item, you need a special tool designed to unpack the array.

Iterator

noun

A tool that processes an array. It takes a collection of items as input and outputs each item one by one as a separate bundle.

The Iterator takes an array and runs the subsequent part of the workflow once for each item in that array. If you feed it an array with 10 spreadsheet rows, the next module in the chain will run 10 separate times, once for each row.

This is perfect for unpacking data, but what about the reverse? After you've processed each item separately, you often need to group them back together. Maybe you've generated a list of user details and now want to send them all in a single summary email. For this, you need an Aggregator.

Aggregator

noun

A tool that merges multiple bundles of data into a single array. It is the functional opposite of an Iterator.

Aggregators are often paired with Iterators. The Iterator breaks the array apart for processing, and the Aggregator puts the processed results back together into a new, single array. You can then use this newly created array in a final action, like sending an email or creating a report.

Lesson image

Mastering Routers, Iterators, and Aggregators is the key to unlocking complex, multi-step automations. They allow you to build workflows that are not just automated, but also intelligent and adaptable to real-world data.

Quiz Questions 1/5

You need a workflow to process incoming orders. Orders over 100shouldtriggeranalerttothesalesteam,whileordersunder100 should trigger an alert to the sales team, while orders under 100 should be sent to the fulfillment department. Which tool would you use to create this conditional logic?

Quiz Questions 2/5

A module in your workflow retrieves a list of 15 email attachments. This collection of attachments is known as a(n) ____.