Skip to content

Decision (rules)

A Decision step checks a table of rules from top to bottom and follows the outcome of the rule that holds. No model decides here: the same data always gives the same outcome. Rules can apply only between two dates, and you can add test cases so a rule change that gives a wrong answer cannot be published. Rules are versioned with the workflow.

  • Credit pre-screening: approve, refer or decline based on income, bureau score and loan amount.
  • Pricing bands: pick a discount tier from order value and customer segment.
  • Festive-season rules that apply only between two dates.
  • There is a single yes or no question. Use Condition.
  • The step must calculate a figure, such as an EMI. Use Compute.
  • The decision needs judgement from a person. Use Approval.
Setting What it does
Outcomes Required. 1 to 12 outcome names. Each becomes a branch. A default branch is added for you; don’t list it.
When several rules hold first (default): the first rule that holds wins. all: every matching outcome is followed, at the same time.
Rules Required. Rows of When (an expression), Outcome, an optional Note, and optional From and Until dates. Checked top to bottom. A rule with dates only applies between them, using the workflow’s time zone.
Test cases Rows of a name, a sample input and the expected outcome. Validation runs them against the rules. For all, list the expected outcomes separated by commas. A sample input can set today to test dated rules.
  • A branch for each outcome, plus default when no rule holds.
  • With all, several branches can run at the same time. Add a Join where they should meet again.
  • The step writes no data. The outcome taken shows in the run’s timeline.

A value that is missing from the run counts as empty, and comparing an empty value is simply false. So input.score >= 750 is false, not an error, before a score arrives. A rule that cannot be worked out at all (for example a division by zero) fails the run, as this step has no error path.

A lender pre-screens personal loan applications.

API / webhook → Decision (credit pre-screen)
approve → Send message (offer) → End
refer → Approval (credit officer) → End
decline → Send message (regret) → End
default → Human task (manual review) → End
When Outcome
input.score < 650 decline
input.score >= 750 and input.amount <= 500000 approve
input.score >= 650 refer

Test case:

{ "name": "Good score, small loan", "input": { "input": { "score": 780, "amount": 300000 } }, "expect": "approve" }