Like other resources, workflow definitions can be added, edited, and deleted. But that’s just the beginning of workflow management.
-
Because workflow definitions can be complex works in progress, they can be versioned.
-
Unpublished drafts can be saved.
-
Because workflow definitions are XML files, they’re portable. Thus, they can also be uploaded.
Start by learning basic workflow management.
Workflow Definition Publication Permissions
Users with permission to edit or publish workflow definitions can add Groovy scripts to the workflow. Access to the scripting engine means access to the Java Virtual Machine (JVM) of the server. Users who publish (or edit) workflow definitions containing scripts, therefore, can get access to any data within the reach of the JVM, such as data contained in a separate Virtual Instance of Liferay DXP itself.
Because of this far-reaching access, permission to create or edit workflow definitions is limited to Regular Administrators of the Default Virtual Instance.
To grant Users with these Roles the workflow publication access in additional Virtual Instances,
- Make sure you understand the access you’re granting these admins.
- Navigate to Control Panel → System Settings → Workflow → Workflow Definition.
- Check the box for the setting Allow Administrators to Publish and Edit Workflows.
This only applies to Virtual Instances that have been added to the system. The Default Virtual Instance provides workflow publication access to Regular Administrators (via Control Panel → Configuration → Workflow), and, if running Liferay DXP, to Site Administrators and other Users with access to the Kaleo Forms Admin applications.
Adding, Editing, and Deleting
To add a workflow definition,
-
Go to Control Panel → Workflow → Process Builder.
-
In the default view (Workflows), click the Add button ().
-
From here you’re either writing an XML definition, designing a definition in in the visual designer (DXP only), or uploading an existing definition.
To edit a definition,
-
Go to Control Panel → Workflow → Process Builder.
-
Click the Actions button () for the workflow, and click Edit.
To delete a definition,
-
Go to Control Panel → Workflow → Process Builder.
-
Click the Actions button () for the workflow, and click Unpublish.
A published workflow cannot be deleted, so you must unpublish its workflow definition first.
You can’t unpublish a definition if it’s activated for an asset. First dissociate the workflow definition from any assets that use it. See here for more information.
Uploading Workflow Definitions
If you have a local XML definition file (perhaps you want to create a new workflow based on one of the embedded workflows), upload it to Liferay DXP:
-
Navigate to Control Panel → Workflow → Process Builder.
-
Click the Add button ().
-
Name the workflow.
-
In the Source tab, click the hyperlink import a file in the sentence
Write your definition or import a file
-
Find the XML file and upload it. Once uploaded, the definition’s XML appears in the workflow editor.
-
If it’s ready to publish, click Publish. Otherwise, Save it and it stays Unpublished.
What’s the difference between saving and publishing?
Published Versus Unpublished
The difference between a published and unpublished workflow is important:
Published: Validation is complete, and the workflow can be assigned to assets.
Unpublished: Validation is not performed on the unpublished workflow, and it cannot be assigned to assets until it’s published.
Workflow Versions
You’re making a simple edit to a workflow, when suddenly you remember you have a meeting with your boss. Quickly you save the workflow and hurry off to your meeting. Congratulations! You were promoted to Director of Business Productivity! You have no time to edit workflows now, so your colleague must finish editing and publishing the workflow. Unfortunately, in all the excitement of your promotion, you forgot what you changed in the workflow. It’s best to revert to the prior version and start editing it from scratch.
-
Open the workflow editor. Go to Control Panel → Workflow → Process Builder, and select the workflow from the list (click its title to open the editor).
-
Click the Information button ()
-
There are two information panel sections: Details and Revision History.
The Details screen shows information about the creation of the workflow and its last modification, and a summary of the total modifications.
The Revision History screen shows the workflow’s current and prior, restorable versions. To view an old workflow or to restore it if you’re sure it’s the right version, click the Actions button () and select either Preview or Restore.
-
When you click Restore and see the success message, the prior version is the current version of the workflow. You can now edit the restored version of the workflow.
-
If edits are necessary, edit and click Update. This creates another version of the workflow.
Alternatively, you can refer to the embedded definitions to get workflow definition ideas.