hub.eb?material_id=585&track_id=586

Introduction to Workflow Decision Nodes


A Decision Node is used to branch a Workflow Process based on a condition.

The specific outbound link the Workflow Job follows is determined by the Decision Node's script, which can be edited by double clicking on the node.

The value of the NEXT_STEP system variable (system.variables.$NEXT_STEP.value) can be used to specify the desired outbound link to follow. Names of outbound Links from Decision Nodes must be changed from their defaults.

The following is an example of a Decision Node script:

if(fields.price.value > 500) {
  system.variables.$NEXT_STEP.value = "manualApproval";
}
else{ 
  system.variables.$NEXT_STEP.value = "automaticApproval";
}

A Decision Node executes in the context of the job and has access to Process Attributes, Tables, and Resources as well as access to the JavaScript Workflow API.

Steps


1

Continuing from Introduction to Workflow System Tasks.

Remove the link connecting supplyEmailNode and sendEmailNode and add a Decision Node between them.

2

Create the following links:

  1. From supplyEmailNode to the Decision Node
  2. From the Decision Node to sendEmailNode, named sendEmailLink
  3. From the DecisionNode to End, named endProcessLink
3

Add the following code block to the Decision Node:

if(fields.email.value) {
  system.variables.$NEXT_STEP.value = "sendEmailLink";
}
else { 
  system.variables.$NEXT_STEP.value = "endProcessLink";
}
4

Run the Test Harness and step through the process, once specifying an email and once not specifying an email.

Current Module

Related