Liferay Objects are integrated
with Liferay's Kaleo workflow engine, so object entries can be routed through
an approval process (e.g. Draft to Pending Review to Approved to Rejected)
before they are considered published, just like Web Content or Blogs entries.
Step 1 — Enable Workflow on the Object
1.
Open the object definition and go to its Details tab.
2.
Confirm the object is integrated with the Workflow
framework (this is automatic for custom objects — no code required).
3.
Save/Publish the object if it is still a draft.
Step 2 — Create or Choose a Workflow Definition
1.
Open the Global Menu, go to Control Panel, and click
Workflow.
2.
Open Process Builder (Kaleo Designer) and click Add (+)
to create a new workflow definition, or use the built-in Single Approver
Workflow as a starting point.
3.
Design the workflow using the drag-and-drop canvas: add
task nodes, assign roles/users to each task, and define transitions between
nodes (e.g. Review to Approve, Review to Reject).
4.
Use the Source (Kaleo XML) tab if you need to hand-edit
the workflow XML directly.
5.
Click Publish to activate the workflow definition (Save
as Draft only stores it locally without activating it).
Step 3 — Link the Workflow Definition to the Object
1.
In Control Panel, go to Workflow, then Process Builder,
and open the Configurations tab.
2.
Find your custom object in the list of Asset Types
(published custom objects appear here automatically).
3.
Click Edit next to the object's asset type entry.
4.
Select the workflow definition you created or published
in Step 2.
5.
Click Save.
6.
For site-scoped objects, repeat this configuration from
Site Administration to Configuration to Workflow instead of the instance-level
Control Panel, so the workflow only applies within that site.
Step 4 — Combine Workflow with a State Field (Optional)
Workflow status (Draft, Pending,
Approved, Denied) is tracked automatically on every object entry's built-in
Status field. If you also want a custom business status — for example,
distinguishing New, In Progress, and Closed on top of the workflow approval
status — add a Picklist-backed State field:
1.
Create a Picklist (Control Panel to Picklists to Add)
listing your custom states.
2.
Go to the object's Fields tab, click Add, and create a
field using that picklist as a State-type field.
3.
Go to the object's State Manager tab and define which
state transitions are valid (e.g. New can move to In Progress, but not directly
to Closed).
4.
Publish the object.
Step 5 — Test the Workflow
1.
Create a new entry for the object through its
application page or the headless REST API.
2.
The entry enters the workflow process instead of being
immediately published — its Status reflects the first workflow node (e.g.
Pending Review).
3.
Log in as a user with the assigned reviewer role and
open My Account to Notifications, or Control Panel to Workflow to My Workflow
Tasks.
4.
Open the task, review the entry, and Approve or Reject
it.
5.
Confirm the entry's status updates accordingly, and
that approved entries are now visible wherever the object's data is displayed
or queried.
Notes
●
Enabling Draft mode on an object (Details tab) lets
users save incomplete entries without triggering workflow, validations, or
actions — those only fire once the user explicitly submits the entry.
●
Workflow definitions can define entirely custom roles,
or reuse existing portal roles for task assignment.
●
Kaleo workflow definitions are portable: they can be
exported/imported as XML and reused across environments (dev, UAT, production).
Best Practices
●
Organize related objects into folders and assign an
External Reference Code (ERC) to each object and folder for easier migration
between environments.
●
Keep relationship names and object names consistent
with your REST API naming conventions, since they cannot be changed after
publishing.
●
Design the default layout's first field tab to include
every mandatory field, so entry creation never gets blocked.
●
Use inheritance on one-to-many relationships (DXP
2025.Q1+/GA132+) when child records should always follow the parent's
permissions.
●
Keep workflow definitions simple at first (single
approver) and expand to multi-stage approval only once the basic flow is
validated.
●
Test workflow-enabled objects with a non-administrator
account to confirm task assignment and notifications work as expected.
Comments
Post a Comment