UiPath Documentation
maestro-automate
latest
false
Maestro Automate user guide

Decision

Configure the Decision node, write its condition, and choose between Decision and Switch, with examples.

What it does​

Splits a workflow into two paths based on a JavaScript condition that is true or false.

Configuration reference​

FieldRequiredDefaultDescription
ConditionYesNoneJavaScript expression that evaluates to true or false. The output of earlier nodes is available as $vars.<nodeName>.<property>.
True branch labelNoTrueLabel shown on the true/yes output handle.
False branch labelNoFalseLabel shown on the false/no output handle.

Writing condition expressions​

Conditions use the same JavaScript environment as the Script node:

// Simple comparison
$vars.httpRequest1.output.code === 200

// Multiple conditions
$vars.data.status === "approved" && $vars.data.amount > 1000

// Null check
$vars.script1.output != null

// String check
$vars.user.role === "admin"
// Simple comparison
$vars.httpRequest1.output.code === 200

// Multiple conditions
$vars.data.status === "approved" && $vars.data.amount > 1000

// Null check
$vars.script1.output != null

// String check
$vars.user.role === "admin"

The condition accepts any JavaScript value, not only true or false. A value that JavaScript treats as true, such as a non-empty text or a number other than zero, takes the true branch, and any other value takes the false branch.

Leaving a branch unconnected​

Both the True and False branches are optional. A branch can be left unconnected when no action is needed for that outcome. When a branch has no node after it, the branch is completed automatically instead of failing at runtime with a path-not-found error.

The Switch node behaves the same way for its branches.

Examples​

Example 1: Branch on HTTP status code​

Condition: $vars.httpRequest1.output.code === 200

  • True: process the response.
  • False: handle the error.

Example 2: Approval gate​

Condition: $vars.reviewForm1.output.approved === true

  • True: continue the workflow.
  • False: notify the requester of the rejection.

Example 3: Null guard​

Condition: $vars.fetchUser1.output != null

  • True: proceed with the user data.
  • False: handle the missing user.

Choosing between Decision and Switch​

Use Decision when...Use Switch when...
You have exactly two outcomes (yes/no, pass/fail, approved/rejected)You have three or more outcomes
The condition is a single boolean expressionYou're matching a value against multiple cases

Next steps​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated