Documentation

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.

You can add an Action to a Task node.

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 or any other type of node in the workflow.

You can add an Notification to a Task node.

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:

  1. Go to the Global menuApplicationsProcess Builder.

  2. Click the Workflows tab.

  3. Click on the Workflow definition (for example, Single Approver).

  4. Click the Update node.

    Modify the Update node.

  5. Click an existing action or New if there are none currently defined.

  6. Enter reject in the Name field.

  7. Select On Assignment from the Execution Type dropdown menu.

  8. 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);
    

    Add the reject action.

  9. Click the back arrow (Back) 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:

  1. In the Update node’s properties sidebar, click an existing notification or New if none are defined yet.

Notifications are found in the Properties tab.

  1. Enter the following:

    • Name: Creator Modification Notification

    • Description: Enter a description for this notification

  2. Select Freemarker from the Template Language dropdown menu.

  3. Enter a message in the Template field:

    • Your submission was rejected by ${userName}, please modify and resubmit.

  4. Select the Notification Type(s):

    • Email

    • User Notification

  5. Select On Assignment from the Execution Type dropdown menu. The Notification is sent when someone is assigned to this task.

  6. Select a recipient type (Asset Creator).

    Add an Notification to the Update node which notifies the creator that the submission has been rejected.

  7. Click the back arrow (Back) when finished (in some versions you must click Save in the notification section).

Notifications on the Update node have been added.