Adding Fields to Clarity's Distributor Management App
A well-designed object captures every piece of information your application needs to fulfill its purpose. Clarity needs to expand their distributor management app to store additional business information and applicant selections from lists of predefined options. In these exercises, you'll add both basic and picklist fields to Clarity’s object definitions. Then, you’ll also add a custom object view for testing purposes.
Exercise: Adding Basic Fields
To evaluate distributor applicants effectively, Clarity wants their data model to capture additional applicant details, including comments and business documents. Here, you’ll add fields manually and using a batch client extension as the Clarity Admin user.
-
Sign in using these credentials:
-
Username:
admin@clarityvisionsolutions.com -
Password:
learn
-
-
Open the Global Menu (
), go to the Control Panel tab, and click Objects.
-
Go to the Distributor Management folder and select View in Model Builder.
-
For the Distributor Application object, click Add Field or Relationship, and select Add Field.
-
Enter these values and click Save.
Field Value Label CommentsField Name commentsType Long Text Enable Entry Translation No Mandatory No -
Repeat the above steps to add this field to the Distributor Application object.
Field Value Label Business LicenseField Name businessLicenseType Attachment Request Files Upload Directly from the User’s Computer Show Files in Documents and Media Yes Mandatory No -
Open a terminal window and navigate to the
client-extensions/liferay-clarity-batch-create-distributor-object-fields/folder in your course workspace. -
Run this command to deploy a batch client extension and add the remaining basic fields to Clarity’s distributor management app:
blade gw clean deploy -
Verify the fields appear in the Distributor Application and Application Evaluation objects.
If the fields don't appear, ensure both objects have the correct ERC:-
Distributor Application:
D4B8_DISTRIBUTOR_APPLICATION -
Application Evaluation:
D4B8_APPLICATION_EVALUATION
-
Together, these fields can help Clarity assess potential distributors.
Exercise: Creating Picklists
Free-form text fields can lead to typos and inconsistent data when capturing categorized information. To ensure data uniformity across applications, Clarity needs to define standardized lists that applicants can choose from (e.g., product categories, business types). Here, you’ll create picklists manually and using a batch client extension as the Clarity Admin user.
-
Open the Global Menu (
), go to the Control Panel tab, and click Picklists.
-
Click Add (
), enter
Product Typesfor name, and click Save.
-
Begin editing the picklist.
-
Click Add (
) and add these items to the picklist:
Name Key EyeglasseseyeglassesSunglassessunglassesContactscontactsLenseslenses
-
Edit each item and set their ERCs to these values:
External Reference Code PRODUCT_TYPE_EYEGLASSESPRODUCT_TYPE_SUNGLASSESPRODUCT_TYPE_CONTACTSPRODUCT_TYPE_LENSES
-
Change the picklist’s ERC to
PRODUCT_TYPES.
-
Click Save.
-
Open a terminal window and navigate to the
client-extensions/liferay-clarity-batch-create-picklists/folder in your course workspace. -
Run this command to deploy the client extension and add the remaining picklists for Clarity’s distributor management app:
-
Verify the new picklists appear.
With these picklists in place, you can now add single select and multi-select fields with predefined options to Clarity’s distributor management app.
Exercise: Adding Picklist Fields
Once you’ve created a picklist, you can use it as a field in your object definition. Clarity needs to add both single-select and multi-select fields to their distributor management app. Here you’ll add field manually and using a batch client extension as the Clarity Admin user.
-
Open the Global Menu (
), go to the Control Panel tab, and click Objects.
-
Go to the Distributor Management folder and select the Distributor Application object to begin editing it.
-
Go to the Fields tab and click Add (
).
-
Enter these values and click Save.
Field Value Label Products of InterestField Name productsOfInterestType Multiselect Picklist Picklist Product Types Mandatory No
-
Open a terminal window and navigate to the
client-extensions/liferay-clarity-batch-create-distributor-object-picklist-fields/folder in your course workspace. -
Run this command to deploy the client extension and add the remaining picklist fields to Clarity’s distributor management app:
-
Verify the picklist fields appear in the Distributor Application and Application Evaluation objects.
Great! Now Clarity’s distributor management app has all the necessary fields for capturing applicant data.
Exercise: Creating a Basic View
Clarity’s objects now include numerous fields, making the default table cumbersome and inefficient to browse during testing. With Liferay, you can create views that control which columns appear in the table without affecting the underlying data. Here, you'll create a simplified, basic view as the Clarity Admin user.
Object views are best suited for internal testing or proof of concept and are not intended for end-user displays. You’ll learn how to build object UIs in Module 6.
-
While editing the Distributor Application object, go to the Views tab.
-
Click Add (
).
-
Enter the name
Basic Viewand click Save.
-
Click the new view to begin editing it.
-
In the Basic Info tab, check Mark as Default.
-
Go to the View Builder tab and click Add Column.
-
Check the following fields and click Save.
-
ID
-
Applicant Name
-
Business Name
-
Create Date
-
Status
-
-
Click Save.
-
Verify your configuration works by creating a Distributor Application entry and verifying its table only displays your selected fields.
Great! Now distributor application entries will be displayed using the view you created. Basic views like this are best suited for testing and administration cases where user experience and site integration are not important.
Conclusion
A complete data model is the foundation of any effective business application. With the new fields, picklists, and basic view in place, Clarity's distributor management app can now capture the information required to evaluate applicants thoroughly and consistently.
Next, you’ll learn how you can add validations to ensure data integrity.
Capabilities
Product
Education
Knowledge Base
Contact Us