Defining a State Field

Delectable Bonsai wants to define a custom state field for tracking an application’s progress and triggering additional business logic. Here you’ll add a picklist that defines these states, use it for a state field in the Distributor Application object, and manage the state field’s flow.

Adding a Picklist for Application States

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

  2. Click Add ( Add Button ).

  3. For name, enter Application States and click Save.

  4. Begin editing the picklist.

    Create and edit the Application States picklist.

  5. Click Add ( Add Button ) to add these items to the picklist:

    NameKey
    Openopen
    Under ReviewunderReview
    Approvedapproved
    Denieddenied
    Withdrawnwithdrawn
    On HoldonHold
  6. Edit each item and set their ERCs to these values:

    External Reference Code
    APPLICATION_STATE_OPEN
    APPLICATION_STATE_UNDER_REVIEW
    APPLICATION_STATE_APPROVED
    APPLICATION_STATE_DENIED
    APPLICATION_STATE_WITHDRAWN
    APPLICATION_STATE_ON_HOLD

    Add items to the picklist and update their ERCs.

  7. Change the Picklist’s ERC to LIST_APPLICATION_STATES.

    Update the picklist's ERC.

  8. Click Save.

You can now use the picklist to create a state field in the Distributor Application object.

Adding the Application State Field

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

  2. Begin editing the Distributor Application object and go to the Fields tab.

  3. Click Add (Add Button), enter these details, and click Save:

    FieldValue
    LabelApplication State
    Field NameapplicationState
    TypePicklist
    PicklistApplication States
    MandatoryTrue
    Mark as StateTrue
    Default ValueOpen

    Add the Application State field to the Distributor Application object.

Managing State Flow

  1. While editing the Distributor Application object, go to the State Manager tab.

  2. Click Application State.

  3. Set these flow values:

    FieldValue
    OpenUnder Review, Withdrawn
    Under ReviewApproved, Denied, Withdrawn, On Hold
    ApprovedUnder Review
    DeniedUnder Review
    WithdrawnOpen
    On HoldOpen, Under Review

    Set these

  4. Click Save.

When updating the Application State field, user options are determined by the state flow.

Using the Application State Field

To practice using the application state, you must first add the field to the object’s layout and view.

Adding the Field the Custom Layout

  1. While editing the Distributor Application object, go to the Layouts tab and begin editing the layout.

  2. In the Info tab, rename the layout to Layout with State Field.

    Rename the layout to Layout with State Field.

  3. Go to the Layout tab

  4. Click Add Field for the General Details block

  5. Select the Application State field and click Save.

    Add the Application State field to the General Details block.

  6. Click Save for the layout.

Adding the Field to the Custom View

  1. Go to the Views tab and begin editing the view.

  2. In the Info tab, rename the view to View with State Field.

    Rename the view to View with State Field.

  3. Go to the View Builder tab.

  4. Click Add, select the Application State field, and click Save.

    Add the Application State field to the view.

  5. Drag and drop fields to reorder them:

    • ID
    • Applicant Name
    • Business Name
    • Create Date
    • Application State
    • Status
  6. Click Save for the view.

Using the Field

  1. Go to Distributor Applications and begin editing an existing application. Even though the entry was created before the state field was added, it’s set to the default value.

  2. Update the state field’s value and click Save. Notice that available options depend on the field’s current value.

    Available options depend on the state flow.

  3. Begin editing the same application.

  4. Update the state field again. Notice that the options are different.

    State field options are different.

Great! Now that you’ve added a state field, Delectable Bonsai wants to add a workflow process that requires review for when users update it to ‘approved’ or ‘denied’.

Next: Adding an Approval Workflow

Relevant Concepts

Capabilities

Product

Contact Us

Connect

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