Workflow Nodes

Workflow Nodes


A Workflow Node represents a specific point in an approval process, whether it begins the review process, approves or rejects the asset, or reassigns the task.

Below are the different types of nodes and the possible actions associated with each node.

Types of Nodes

Node Description
Task Task nodes indicate the workflow task and its assignee.
Fork and Join Fork and Join are paired nodes for splitting the review process for multiple reviewers in parallel, and then rejoining when reviews are complete.
Join XOR The Join XOR node allows the workflow to proceed as long as the transition from one of the parallel reviewers is invoked.
Condition The Condition node establishes a condition before the review process can proceed.
Start The Start node begins the workflow.
End The default End node by default sets the workflow status to Approved.
State State nodes place the review process in a particular mode, or state. Start and End nodes are special types of state nodes.

Start and End Nodes

Start and end nodes kick off workflow processing and bring the asset to its final, approved state. Often you can use the default start and end nodes without modification.

End nodes have a default action that sets the workflow status to Approved using the Groovy scripting language:

import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;

WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("approved"), workflowContext);

State Nodes

State nodes can have Actions and Notifications. For example, you can create a node that sets the status to Expired, using this Groovy script:

import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil;
import com.liferay.portal.kernel.workflow.WorkflowConstants;

WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("expired"), workflowContext);

Condition Nodes

A Condition node checks an asset or its execution context, and depending on the result, sends it to the appropriate transition. This node requires a script that sets a value to one of the transitions.

In the Category Specific Definition is a script that looks up the asset in question, retrieves its asset category, and sets an initial returnValue. Then it checks to see if the asset has been marked with the legal category. If not it goes through Content Review (the content-review task in the workflow), and if it does it goes through Legal Review (the legal-review task in the workflow).

Task Nodes

Task nodes represent where all the work is done. See Creating Workflow Tasks and Using Task Nodes.