Adding and Managing Custom States

Liferay 7.4+

Some use cases may require assigning multiple states to an object entry at the same time. For example, when building an Order application, you may need to assign and manage order, payment, and delivery statuses for the same entry, each with its own flow and associated business logic. Using Liferay picklists with custom objects, you can achieve this functionality.

With picklists, you can define lists of strings and use them as object fields to define custom states for entries. Once added to an object definition, you can design the flow for each state and use validations and actions to add business logic for different states. States can also be used alongside workflow statuses to define more complex review and approval processes.

Use picklists to add custom states to object definitions.

Adding a State Field to Object Definitions

  1. Open the Global Menu (Global Menu), go to the Control Panel tab, and click Picklists.

  2. Create a picklist with the desired items. These items define object entry states. See Creating Picklists for more detailed steps.

    note

    You can add, remove, or edit picklist items for both draft and published object definitions at any time.

    Create a picklist with the desired items.

  3. Open the Global Menu (Global Menu), go to the Control Panel tab, and click Objects.

  4. Begin editing the desired custom object.

  5. Go to the Fields tab and click Add (Add Button).

    Begin adding a field to the object definition.

  6. Enter a Label and Field Name.

  7. Select the Picklist type and choose the desired list.

  8. Toggle Mark as State.

    note

    State fields are set automatically to mandatory, and you cannot change them to optional.

  9. Select a Default Value for the state field.

    Select a picklist, toggle Mark as State, and set a default value for the field.

  10. Click Save.

After adding the field to a definition, you can set up a flow to determine which transitions are available for each state.

Setting Up a Flow for State Fields

By default, each state can transition to all other states. However, you can restrict transitions to ensure the entry goes through the desired process.

Follow these steps to set up a custom flow for state fields:

  1. While editing a custom object, go to the State Manager tab and select the desired state field.

    Go to the State Manager tab to set up a flow for state fields.

  2. Under Next Status, click the drop-down menus and check the boxes to determine available transitions for each state.

    You can select any number of transitions for a state.

    Determine the available transitions between states.

  3. Click Save.

Once saved, users can only transition an entry’s state according to your defined flow.

Set up a custom flow determines available transitions for each state.

Capabilities

Product

Contact Us

Connect

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