Flow conditions

How to write a condition in a flow, which data it can look at, ready-made examples by industry and how to test it before activating.

Updated:

A condition decides which branch a flow follows. It is written as a short sentence that gives true or false, for example "the service costs more than 100 and the customer is VIP". A condition only looks at data: it changes nothing.

How it is written

WhatExample
Compare== (equal), !=, <, <=, >, >=
Combine&& (and), || (or), ! (not)
Text"delivery" in quotes
Is in a list"vip" in customer.tags
Containsservice.name.contains("Haircut")
If / thenworkItem.priority == "urgent" ? now.hour < 22 : now.hour < 18
A fieldcustomer.no_show_count, with a dot

That is the whole language: no loops or custom functions. Conditions are validated when you save the flow and again when you activate it.

Which data it can look at

ObjectWhat it has
triggerThe event that started the flow. With an executed action: action_key (the action), from_stage, to_stage
workItemThe task: status, stage, priority, tags, party_size, start_at, due_at, age_minutes (minutes since it was created), assigned (whether it has an owner)
customername, locale (language), tags, no_show_count (real no-shows)
servicename, price_cents (the price in cents: 100.00 is 10000), deposit_cents, duration_min
resourcename, kind
nowYour business's time: hour, minute, weekday (0 = Monday ... 6 = Sunday)
variablesValues calculated by an earlier step

For privacy, a condition cannot see phones, emails, documents, addresses or customer notes. If the event does not carry a task, workItem, customer and service arrive empty and the condition fails with a clear message instead of silently answering "false".

Examples

VIP with an expensive service: alert the manager

service.price_cents > 10000 && "vip" in customer.tags

"Not home" before 6 pm (trigger: an action is executed)

trigger.action_key == "nao_estava" && now.hour < 18

Third no-show: ask for a deposit next time

trigger.action_key == "ausencia" && customer.no_show_count >= 3

Task unassigned for more than 2 hours (after a 2 h Wait step)

!workItem.assigned && workItem.age_minutes > 120

Outside business hours (Saturday, Sunday or outside 9 to 18)

now.weekday >= 5 || now.hour < 9 || now.hour >= 18

Urgent task

workItem.priority == "urgent" || "urgente" in workItem.tags

Customer who speaks Portuguese

customer.locale == "pt"

Deposit pending for over an hour

workItem.stage == "aguardando_sinal" && workItem.age_minutes >= 60

Long haircut service

service.name.contains("Corte") && service.duration_min >= 45

Action and stage keys (ausencia, nao_estava, aguardando_sinal) are the ones from your industry template. If you renamed them, use yours. Text values such as "Corte" must match the name your service has.

Test a condition

In a flow's detail, tap Test this condition (or Test a condition):

  1. Write the condition.
  2. Pick a real task from your project with the search box.
  3. If it looks at trigger.action_key, write the action key in Simulate the action.
  4. Tap Test.

It shows True or False and, below, What the condition saw: exactly the data it decided with. Nothing is executed.

Common errors

When saving, the message says which step failed and why:

ProblemWhat it means
The field does not existYou used data that is not available (for example customer.email)
Types that do not matchYou compared text with a number (customer.name > 5)
Not true or falseThe condition must be a yes or no question
Function not allowedOnly contains exists
Unknown objectOnly the objects in the table above can be used
Too long or costlySplit it into two conditions with another step in between

A condition accepts up to 1024 characters and is evaluated in a fraction of a second.