Skip to content

IF

The If operation checks a condition and then runs the actions in Do, or, if the condition is false, those in Else. Do and Else contain actions with the same structure as Actions, including further If or Loop. Their names must be unique in the whole workflow; their results are reachable by name as usual afterwards.

A condition compares a value on the left with a fixed value on the right: {{path}} operator value.

In the diagram of the workflow editor If has a form with the Condition field (==, !=, >, <, >=, <=, combined with && and ||, text in quotes); drag values in from the test view. StopWorkflow has the Reason field there.

Operator Meaning For
==, != equal, not equal numbers, texts, booleans
>, <, >=, <= greater, less … numbers only
&&, || and, or several comparisons
  • The left side is a placeholder (or a value), the right side a fixed value. Placeholders on the right are not replaced.
  • Numbers are also recognized as text, with dot or comma: "1234,50" and "1234.50" yes, "1.234,50" no.
  • Texts on the right in quotes: {{Country}} == "DE". Case matters.
  • Booleans: == true only works with real booleans. From an HTTP response they arrive as text; compare with "true" then.
  • If the placeholder on the left cannot be resolved, the comparison is false, even with !=.
  • && and || can be mixed but not grouped: a && b || c means “(a and b) or c”.
{
"Type": "If",
"Name": "LargeInvoice",
"Parameters": {
"Condition": "{{InitialData.Invoice.BG22.BT112}} > 1000",
"Do": [ { "Type": "SMTP", "Name": "RequestApproval", "Parameters": { … } } ],
"Else": [ { "Type": "SMTP", "Name": "SendDirectly", "Parameters": { … } } ]
}
}
Parameter Meaning
Condition The condition
Do Actions that run when the condition is true
Else Actions that run otherwise (optional)
"Response": {
"ExecutedBranch": "If",
"SuccessCount": 1,
"ErrorCount": 0,
"Condition": "{{InitialData.Invoice.BG22.BT112}} > 1000"
}

ExecutedBranch is If (Do ran), Else or None (condition false and no Else). The value RUNOS compared is in the log under ConditionEvaluated.

If an action in Do or Else fails, the remaining actions of the branch don’t run, and the If fails with that error. The If’s error policy then applies; with RetryThenNotify the whole branch is retried.

The StopWorkflow action ends the current run immediately and then stops the workflow. No new runs start, not even after a restart of RUNOS, until you start it again in the list. With Run in the editor only the run ends.

{ "Type": "StopWorkflow", "Name": "Halt", "Parameters": { "Reason": "Error in {{Error.Action}}: {{Error.Message}}" } }
Parameter Meaning
Reason Reason for the log, with placeholders. Without it: “Stopped by action.” The result contains it as Response.Reason.

StopWorkflow works anywhere: in an If, in a Loop or at the end of OnError, so that after an error report not every further file fails on the same problem.

Question Condition
Does a value have content? {{InitialData.Email}} != ""
Is a list not empty? {{Query.Response.Body.items.count}} > 0
Did an action succeed? {{Send.Response.Results.Status}} == "OK"
Amount and country {{Amount}} > 1000 && {{Country}} == "DE"
One of two values {{Status}} == "Error" || {{Status}} == "Rejected"

Don’t send invoices without a recipient address; report them and stop the workflow instead. The workflow contains "InitialData": { "Email": "" }, and a script block in the file sets the address. Without this default, {{InitialData.Email}} could not be resolved and the comparison would always be false.

{
"Type": "If",
"Name": "RecipientMissing",
"Parameters": {
"Condition": "{{InitialData.Email}} == \"\"",
"Do": [
{ "Type": "SMTP", "Name": "Report", "Parameters": { "To": "accounting@example.com", "Subject": "Invoice {{FileName}} without recipient", "Body": "…" } },
{ "Type": "StopWorkflow", "Name": "Halt", "Parameters": { "Reason": "Recipient missing in {{FileName}}" } }
],
"Else": [
{ "Type": "SMTP", "Name": "SendInvoice", "Parameters": { "To": "{{InitialData.Email}}", "Attachments": "{{FilePath}}", "Body": "…" } }
]
}
}