Configuring Workflow Actions and Notifications
Subscription
Using the workflow designer, users can configure Workflow Actions and notifications for each node.
Actions are very adaptable and you can specify when the Action occurs: before entering the node, after exiting a node, or once a task node is assigned. For example, when a reviewer rejects a Web Content article, a Workflow Action sets the asset’s status as Pending and automatically reassigns the article to the original author.
Workflow Notifications are sent to tell task assignees that the workflow needs attention or to update asset creators on the status of the process. They can be sent for tasks, task timers, or any other type of node in the workflow.
However, not every node requires a Workflow Action or a notification. Generally, Start and End nodes do not have actions or notifications, unless you want to notify the original author that the review process has begun or ended.
In the Single Approver definition, the two Task nodes (Review and Update) have Actions and Notifications.
Adding Actions
If you’re creating the Single Approver workflow definition, you must add a Reject Action to the Update Task node. This Reject Action contains a Groovy script which, when executed, sets the asset’s status as denied then pending.
Follow the steps below:
-
Go to the Global menu → Applications → Process Builder.
-
Click the Workflows tab.
-
Click on the Workflow definition (for example, Single Approver).
-
Click the Update node.
-
Click an existing action or New if there are none currently defined.
-
Enter reject in the Name field.
-
Select On Assignment from the Execution Type dropdown menu.
-
Enter the script in the Template (Groovy) field (it’s called the Script field in some versions). The Single Approver workflow contains an Update task with an action written in Groovy that sets the status of the asset as denied, then sets it to pending.
import com.liferay.portal.kernel.workflow.WorkflowConstants; import com.liferay.portal.kernel.workflow.WorkflowStatusManagerUtil; WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("denied"), workflowContext); WorkflowStatusManagerUtil.updateStatus(WorkflowConstants.getLabelStatus("pending"), workflowContext);
-
Click the back arrow () when finished (in some versions you must click Save in the action definition).
Next add a notification that informs the asset creator that the submission has been rejected at this time and needs more work.
Adding Notifications
Add notifications to the Update Task node which informs the asset creator that the submission needs more work and has been reassigned back to him.
Follow the steps below:
- In the Update node’s properties sidebar, click an existing notification or New if none are defined yet.
-
Enter the following:
- Name: Creator Modification Notification
- Description: Enter a description for this notification
-
Select Freemarker from the Template Language dropdown menu.
-
Enter a message in the Template field:
Your submission was rejected by ${userName}, please modify and resubmit.
See Workflow Notification Template Variables to learn about the injected template variables.
-
Select the Notification Type(s):
- User Notification
-
Select On Assignment from the Execution Type dropdown menu. The Notification is sent when someone is assigned to this task.
-
Select a recipient type (Asset Creator).
-
Click the back arrow () when finished (in some versions you must click Save in the notification section).
Notifications on the Update node have been added.