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
-
Open the Global Menu ( ), go to the Control Panel tab, and click Picklists.
-
Click Add ( ).
-
For name, enter Application States and click Save.
-
Begin editing the picklist.
-
Click Add ( ) to add these items to the picklist:
Name Key Open open
Under Review underReview
Approved approved
Denied denied
Withdrawn withdrawn
On Hold onHold
-
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
-
Change the Picklist’s ERC to
LIST_APPLICATION_STATES
. -
Click Save.
You can now use the picklist to create a state field in the Distributor Application object.
Adding the Application State Field
-
Open the Global Menu ( ), go to the Control Panel tab, and click Objects.
-
Begin editing the Distributor Application object and go to the Fields tab.
-
Click Add (), enter these details, and click Save:
Field Value Label Application State Field Name applicationState
Type Picklist Picklist Application States Mandatory True Mark as State True Default Value Open
Managing State Flow
-
While editing the Distributor Application object, go to the State Manager tab.
-
Click Application State.
-
Set these flow values:
Field Value Open Under Review, Withdrawn Under Review Approved, Denied, Withdrawn, On Hold Approved Under Review Denied Under Review Withdrawn Open On Hold Open, Under Review -
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
-
While editing the Distributor Application object, go to the Layouts tab and begin editing the layout.
-
In the Info tab, rename the layout to Layout with State Field.
-
Go to the Layout tab
-
Click Add Field for the General Details block
-
Select the Application State field and click Save.
-
Click Save for the layout.
Adding the Field to the Custom View
-
Go to the Views tab and begin editing the view.
-
In the Info tab, rename the view to View with State Field.
-
Go to the View Builder tab.
-
Click Add, select the Application State field, and click Save.
-
Drag and drop fields to reorder them:
- ID
- Applicant Name
- Business Name
- Create Date
- Application State
- Status
-
Click Save for the view.
Using the Field
-
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.
-
Update the state field’s value and click Save. Notice that available options depend on the field’s current value.
-
Begin editing the same application.
-
Update the state field again. Notice that the 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