Make decisions
Use If to run steps only when something is true, Otherwise for when it isn't, and a chain of Ifs for three or more cases.
An If step runs the steps inside it only when its condition is true. An Otherwise step after them holds the steps to run when it isn't. An End if step closes the section, and the workflow carries on with whatever comes after it either way.
Post only large payments
- Trigger
New Stripe payment
Stripe
Append row
Google Sheets
If
Built-in step · @payment.amount is at least 100000
Send a message to a channel
Slack · #sales
End if
Built-in step
Write the condition
The If step's Only continue if field takes the condition. Write it the way you'd say it, as a test of values from earlier steps:
@payment.amountis at least100000@email.subjectcontainsinvoice@row.Statusis""(the cell is empty)@todayis a public holiday
Combine tests with and and or. A range needs both ends: "days left is at least 0 and at most 30", or past dates slip in.
Or describe it in plain words
When a decision doesn't fit a rule, such as "this email is a sales lead", describe the condition in your own words and let the workflow judge it. Only that condition uses AI; every other step still runs the same way each time.
If later steps need more than a yes or no, such as a category and a reason, use an AI agent that returns those fields, and test them with ordinary conditions.
Three or more cases
To choose between several cases, put the next If directly inside the Otherwise. Lodol treats the chain as one decision with a path for each case, and the last Otherwise catches anything left over:
Route a support email
- Trigger
Gmail New Email
Gmail
Run an AI agent
Built-in step · returns category
If
Built-in step · @triage.output.category is urgent
Send a direct message
Slack
Otherwise
Built-in step
If
Built-in step · @triage.output.category is question
Create draft
Gmail
Otherwise
Built-in step
Add label to message
Gmail
Keep the Otherwise holding nothing but the next If. Steps that every case shares go after the whole chain.
Avoid the usual surprises
- Text is compared exactly. "Paid" is not "paid". Compare text that people type through Format text set to lowercase.
- Compare money in the unit you mean. Stripe amounts are in cents. Divide by 100 in a step before the If, and the condition reads "at least 1000".
- Compare dates as days. To check "within 30 days", use Difference between dates and compare the number, not the dates themselves.
- Approvals give you a yes or no. After a Request approval step, test
@approval.approvedrather than matching words someone typed.
Reference
Every field of the If and Otherwise steps is on the Decisions reference page.
Connections and secrets
Workflows use your app accounts through connections, and your own API keys as secrets. Both are encrypted, used by name, and never shown in a workflow or to your AI.
Repeat steps
Use Repeat to run steps once for each item in a list, a set number of times, or while something is true, and avoid the mistakes that make loops quietly wrong.