Mastering Data Modeling with Liferay Objects

Course Overview

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.

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

Liferay workflow supports both versioned and non-versioned items. For example, web content is versioned. When editing a web content entry, a new version is created and undergoes the approval process while the current approved version remains visible.

However, object entries are not versioned. So, if you change an object entry with workflow enabled, the object immediately becomes 'Unapproved' without retaining a previous accessible version. This difference means that if an object edit is pending approval, the entry is inaccessible to users until re-approved, which is an essential factor when deciding to enable workflows for objects.

Before enabling workflow for objects, consider whether an object's entries must always be available to end-users. If uninterrupted access is essential, explore alternative approaches to manage changes and approvals, such as object states.

To use workflow with objects effectively, consider these best practices:

  • 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.

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 your implementing and whether approvals are necessary.

Use workflows for approval-driven processes, especially when managing entries that require structured reviews. Generally, workflows are ideal for versioned assets, like web content and documents, since versioning ensures the content remains available while edits await approval. Since object entries are not versioned, workflow works best with objects that store content that doesn’t require updating after approval.

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.

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 management app.

  • Liferay’s Workflow Engine

  • Using Workflow with Objects Effectively

  • Object States

  • Using Object States Effectively

  • Workflow or Object State: Which One to Use and When

  • Conclusion

Loading Knowledge

Capabilities

Product

Education

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy