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.
When to use it
Section titled “When to use it”- 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.
When not to use it
Section titled “When not to use it”- 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.
Settings
Section titled “Settings”| 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. |
What it produces
Section titled “What it produces”- A branch for each outcome, plus
defaultwhen 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.
Example
Section titled “Example”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" }