Setting Up Clarity’s Distributor Solution
Clarity’s development team has been working on implementing their distributor onboarding solution. In addition to using objects and client extensions, they have also leveraged page builder features to design a dynamic, responsive user interface for their custom application.
While most parts of the solution are complete, some features remain unfinished. In the following exercises, you will
- Set up and deploy the pre-built solution with a batch client extension.
- Test the solution by creating Distributor Application and Application Evaluation entries.
- Add additional fields and picklist items to the Distributor Application object.
- Assign the appropriate permissions to the Distributor Application object.
These exercises demonstrate the powerful functionality and granular control you can achieve by using objects and client extensions together.
Exercise: Deploying Clarity’s Distributor Solution
The training workspace includes a batch client extension for quickly setting up two object definitions and their related picklists. The specific process for deploying client extensions depends on your Liferay hosting model (i.e., Self-Hosted, PaaS, or SaaS). However, in all cases, you must add the compiled .zip
file to the Liferay server’s [Liferay Home]/osgi/client-extensions/
folder. Here you’ll deploy the batch client extensions and explore what they include as the Clarity Admin user.
-
In your training workspace, go to the
[repository-root]/client-extensions/liferay-clarity-batch/
folder. -
Run this command to build and deploy the client extension:
blade gw clean deploy
Or use Gradle Wrapper:
../../gradlew clean deploy
-
Verify the command executes successfully.
Two new object definitions and their picklists were added to your Liferay instance. Let’s explore them.
-
While logged in as the Clarity Admin user, open the Global Menu (), go to the Control Panel tab, and click Picklists.
Picklists are predefined lists of items that you can use for single select and multi-select fields in object definitions. Here are picklists imported by the batch client extension:
- D4B8 Annual Purchase Volumes
- D4B8 Application States
- D4B8 Assessment Scores
- D4B8 Business Types
- D4B8 Decisions
- D4B8 Distribution Channels
- D4B8 Distribution Regions
- D4B8 Order Types
- D4B8 Product Labels
- D4B8 Product Types
- D4B8 Recommendations
-
Open the Global Menu (), go to Control Panel, and click Objects.
Here you’ll see two new object definitions imported by the batch client extension:
- D4B8 Distributor Application
- D4B8 Application Evaluation
As we’re adding more object definitions, let’s add a folder for organizing our objects and place the D4B8 objects into it.
-
Click Add () for Object Folders.
-
For label, enter
Distributor Applications
. -
Click Create Folder.
-
Click View in Model Builder.
The Objects Model Builder is a graphical interface that displays each object definition as a card and visualizes relationships between them. With it, you can create, manage, and extend data models in the Objects application and quickly configure definitions, fields, and relationships.
-
In the left side panel, click Actions () for D4B8 Distributor Application and select Move to Current Folder.
-
Repeat this step for D4B8 Application Evaluation.
-
Drag and and drop the cards to reposition them and better see their relationship.
Exercise: Testing the Distributor Solution
In the following lessons, you’ll learn more about these objects and how they’re configured. Here you’ll create and review a Distributor Application entry as the Clarity Admin user.
To do this,
-
Sign in as the Clarity Admin user.
- Email:
admin@clarityvisionsolutions.com
- Password:
learn
- Email:
-
Open the Global Menu () and go to the Control Panel tab. Both D4B8 Application Evaluations and D4B8 Distributor Applications should appear in the Object category.
-
Open D4B8 Distributor Applications.
-
Click Add () to create an entry.
-
Fill out the required fields and click Save.
Note: You must enter a business name. We’ll use this value with client extensions in a later exercise.
-
Return to the Distributor Applications overview page and verify your entry appears in the table.
Now you can create an evaluation for this entry.
-
Open the Global Menu (), go to the Control Panel tab, and click D4B8 Application Evaluations.
-
Click Add D4B8 Application Evaluation to create an evaluation for the application.
-
In the Application to Evaluations field, select the application you created. It is identified by the Business Name field.
-
Fill out the evaluation form and click Save.
-
Return to the Application Evaluations overview page and verify the entry appears in the table.
This evaluation is automatically related to the selected application. You can confirm these entries are related by returning to Distributor Applications overview page, selecting the application, and going to the Evaluation Notes tab.
Exercise: Adding Fields to the Distributor Applications Object
The Distributor Applications object already contains several custom fields, but Clarity needs one for applicants to list other brands they offer. Here you’ll add a field to the Distributor Applications Object as the Clarity Admin user.
To do this,
-
Open the Global Menu (), go to the Control Panel tab, and click Objects.
-
Click the Distributor Applications folder.
-
Click View in Model Builder.
-
Look for the D4B8 Distributor Application object, click Add Field or Relationship, then select Add Field.
-
Enter these values and click Save:
Field Value Label Business Other Brands Offered Field Name businessOtherBrandsOffered
Type Long Text Enable Entry Translation False Mandatory False
Each saved field is added immediately to the object and automatically appears in its default layout when creating entries. However, the Distributor Application object has a custom layout that must be modified to include the new field.
To add the field to the object’s layout,
-
Click Actions () for D4B8 Distributor Application and select Edit in Page View.
-
When prompted, select Open Page View.
-
Go to the Layouts tab and click Application Layout.
-
Go to the Layout tab.
-
Find the Business Details block and click Add Field.
-
Select Business Other Brands Offered as an option, choose the single column box for the field size, and click Save.
-
Click Save at the bottom of the panel.
Now the new field appears in the layout when creating entries.
Exercise: Adding Picklist Items
Clarity uses picklists to create predefined options for the applicants to choose from. Currently, the Product Types picklist is empty and does not include any options. Here you’ll add items to the picklist as the Clarity Admin user.
To do this,
-
Open the Global Menu (), go to the Control Panel tab, and click Picklists
-
Select D4B8 Product Types.
-
Click Add and create these items:
Name Key Eyeglasses eyeglasses Sunglasses sunglasses Lenses lenses Contacts contacts Other other -
Click each item and replace their External Reference Code with these values:
Name External Reference Code Eyeglasses PRODUCT_TYPE_EYEGLASSES Sunglasses PRODUCT_TYPE_SUNGLASSES Lenses PRODUCT_TYPE_LENSES Contacts PRODUCT_TYPE_CONTACTS Other PRODUCT_TYPE_OTHER -
Click Save.
Once saved, the Distributor Application’s Products of Interest
custom field is updated with the selected picklist values. This allows applicants to choose their desired products from the updated list.
Exercise: Assigning Object Permissions
Clarity wants to allow all authenticated users to submit distributor applications. Here you’ll grant the default User role permission to access Distributor Applications and add entries as the Clarity Admin user.
To do this,
-
Open the Global Menu (), go to the Control Panel tab, and click Roles.
-
Select the User role and go to the Define Permissions tab.
-
In the left menu, go to Control Panel → Object → D4B8 Distributor Applications.
-
Add these permissions:
Permission Application Permissions: View Resource Permissions > D4B8 Distributor Applications: Add Object Entry Resource Permissions > D4B8 Distributor Application: Delete Resource Permissions > D4B8 Distributor Application: Update -
Click Save.
-
Verify the User role has the desired permissions.
Clarity also wants to allow members of their business development team to review all applications and fill out evaluations. To achieve this, let’s grant the Business Development Manager role the necessary permissions.
-
Return to the Roles overview page and select D4B8 Business Development Manager.
-
Go to the Define Permissions tab.
-
In the left menu, go to Control Panel → Object → D4B8 Distributor Applications.
-
Add these permissions, and click Save:
-
D4B8 Distributor Applications
Permission Application Permissions: Access in Control Panel Application Permissions: View Resource Permissions > D4B8 Distributor Application: Update Resource Permissions > D4B8 Distributor Application: View -
D4B8 Application Evaluations
Permission Application Permissions: Access in Control Panel Application Permissions: View Resource Permissions > D4B8 Application Evaluations: Add Object Entry Resource Permissions > D4B8 Application Evaluation: Add Discussion Resource Permissions > D4B8 Application Evaluation: Delete Resource Permissions > D4B8 Application Evaluation: Delete Discussion Resource Permissions > D4B8 Application Evaluation: Update Resource Permissions > D4B8 Application Evaluation: Update Discussion Resource Permissions > D4B8 Application Evaluation: View
-
-
For test purposes, go to the Assignees tab and assign this role to Harper Roberts.
Great! Now Clarity can make sure the business development team’s manager can view submitted applications, create evaluations, and approve or deny applications.
Conclusion
Congratulations! You’ve deployed and tested Clarity’s custom solution, modified its objects, and assigned them the appropriate permissions. Next, you’ll learn more about implementing business logic to fully integrate a custom solution with the Liferay platform.
Next Up: Implementing Business Logic.
Additional Resources
See official documentation to learn more about using client extensions to migrate object definitions: