Defining Workflows and Managing States

Liferay provides robust tools for managing approval workflows and object states, empowering users to automate processes, streamline approvals, and map complex business logic. Both workflows and object state fields play essential roles but serve different purposes in managing and tracking lifecycles.

Liferay’s Workflow Engine

A workflow engine automates and enforces approval processes within applications, ensuring that content or object entries follow specified review paths before becoming active or published. In Liferay, workflows are primarily designed for approval processes and are used for content publication, forms, orders, and object entries. They provide accountability, quality control, and compliance with organizational standards.

A workflow engine automates and enforces approval processes within applications.

You activate different workflows for specific asset types, so you can customize how to handle content approvals across Liferay applications. The Workflow Designer tool enables you to create visual workflows that specify tasks, roles, and transitions, creating a logical flow for content approvals.

NOTE
As of Liferay DXP 2025.Q3, workflows now apply to root object data models. When you enable a workflow on a root object, every child object definition in the same root context inherits the parent's workflow configuration automatically. This eliminates the need to maintain duplicate workflows for related child objects and ensures the entire ticket lifecycle follows the same approval rules.

Benefits of Using Workflow

  • Quality Control: Workflows help maintain high standards by enforcing structured review steps before publication.

  • Compliance: Workflows ensure adherence to internal policies and create an audit trail for approvals.

  • Collaboration: Reviewers and contributors collaborate seamlessly, with workflows assigning tasks and notifying stakeholders at each stage.

  • Efficiency: Automation reduces manual follow-ups, making review processes faster and more consistent.

While Liferay's workflow engine is effective for approval sequences, it is not a full BPM (Business Process Management) tool and is best suited for straightforward approval workflows rather than complex business processes.

Using Workflow with Objects Effectively

By default, object entries are not versioned. This means if you edit an entry that is tied to a workflow, its status immediately changes to Unapproved, making it inaccessible to end users until the review process finishes. To prevent this disruption, Liferay DXP 2026.Q1 introduced object entry versioning. While enabled, Liferay continues to display the last approved version of the object entry while the latest version undergoes review.

Before implementing a workflow, evaluate whether uninterrupted data access is critical for your users. If it is, you must either enable versioning for the object definition or use an alternative approval method (e.g., object states) to avoid blocking access during edits. Additionally, consider these best practices for using workflows with objects effectively:

  • Enable Notifications: Set up task notifications to keep assignees updated at each workflow stage, reducing delays and improving awareness.

  • Use Task Timers: For time-sensitive workflows, configure timers to remind reviewers or escalate tasks if they aren’t completed within a specified timeframe.

  • Limit Workflow Complexity: Keep workflows straightforward by avoiding excessive branching or conditions. This minimizes bottlenecks and makes workflows easier to maintain and adjust.

By pairing these strategies with version management, you can enforce strict quality control without disrupting the end-user experience.

Object States

Object states enable you to map out complex business processes using picklists and fields. To set them up, you first create a picklist with all possible state values for the process you’re defining (e.g., ‘Open', 'In Review'). Then, you use the picklist as a state field in your object definition. Once added, you can determine valid transitions between states. You can also use validations and actions to add business logic for different state transitions.

Object states enable you to map out complex business processes using picklists and fields.

Unlike workflows, object states are embedded directly within objects and can work with object actions to automate processes. This is especially helpful when you need to track multiple processes for an object entry at the same time. For example, Clarity wants to track the evaluation state of applications independently from their workflow status. To implement this, Clarity can leverage Liferay picklists with objects to define custom states for entries. They then can define a flow for valid state field transitions within the object definition itself.

Benefits of Using Object States

  • Complex Process Mapping: Define detailed, multi-step processes tailored to your business needs, like tracking distributor applications through multiple stages.

  • Automated Actions: Implement real-time automation tied to state transitions, reducing the need for manual intervention.

  • Alternative Lifecycle Management: Define and track an entry’s lifecycle while ensuring continuous availability, unlike workflows' behavior with non-versioned entities.

Using Object States Effectively

Object states provide a powerful mechanism for defining and managing the lifecycle of your object entries. By carefully planning your state transitions and integrating them with object actions, you can create efficient and automated workflows that enhance your business processes.

To use object states effectively, consider these best practices:

Best Practices for Using Object States

  • Define Clear Transition Rules: Clearly define valid state transitions to ensure logical progressions (e.g., only transitioning to 'Approved' from 'In Review').

  • Pair with Object Actions: Use state transitions to trigger actions, like notifications and webhooks (e.g., notifying managers when applications move from 'In Review' to 'Approved').

  • Manage Sensitive State Fields: Ensure only authorized users can modify sensitive state fields by making them read-only and using standalone actions to manage transitions.

Workflow or Object State: Which One to Use and When

Though you can use workflows and object states together, carefully consider which tool is best for the processes you're implementing. This often depends on the complexity of the process and whether formal approvals are necessary.

  • Use workflows for approval-driven processes, especially when managing entries that require structured reviews. When applying workflows to objects, enable versioning to ensure the last approved entry remains accessible while the new version undergoes review.

  • Use object states for tracking complex business processes within objects that are not strictly related to approval. Object states provide a flexible alternative for defining stages and statuses, especially when paired with object actions to automate transitions, updates, and notifications.

By strategically combining both tools, you can enforce strict governance for approvals while supporting complex lifecycle stages.

Conclusion

Understanding the strengths of workflows and object states empowers you to effectively manage approval processes and complex business logic. By using these tools strategically, you can build efficient, user-focused applications that streamline operations and enhance productivity.

Next, you’ll implement a custom workflow and state field for Clarity’s distributor solution.

Loading Knowledge