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.

  1. In your training workspace, go to the [repository-root]/client-extensions/liferay-clarity-batch/ folder.

  2. Run this command to build and deploy the client extension:

    blade gw clean deploy
    

    Or use Gradle Wrapper:

    ../../gradlew clean deploy
    
  3. Verify the command executes successfully.

    Two new object definitions and their picklists were added to your Liferay instance. Let’s explore them.

  4. While logged in as the Clarity Admin user, open the Global Menu (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

    Picklists for the object definitions.

  5. Open the Global Menu (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

    Picklists for the object definitions.

    As we’re adding more object definitions, let’s add a folder for organizing our objects and place the D4B8 objects into it.

  6. Click Add (Add Folder Button) for Object Folders.

  7. For label, enter Distributor Applications.

  8. Click Create Folder.

    Create a new object folder.

  9. 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.

  10. In the left side panel, click Actions (Actions menu) for D4B8 Distributor Application and select Move to Current Folder.

    Move the D4B8 Distributor Application object definition to the new folder.

  11. Repeat this step for D4B8 Application Evaluation.

  12. 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,

  1. Sign in as the Clarity Admin user.

    • Email: admin@clarityvisionsolutions.com
    • Password: learn
  2. Open the Global Menu (Global Menu) and go to the Control Panel tab. Both D4B8 Application Evaluations and D4B8 Distributor Applications should appear in the Object category.

    The Control Panel now shows the Application Evaluations and Distributor Applications menus.

  3. Open D4B8 Distributor Applications.

  4. Click Add (Add Button) to create an entry.

  5. 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.

  6. Return to the Distributor Applications overview page and verify your entry appears in the table.

    The created application entry is displayed in the Distributor Application menu.

    Now you can create an evaluation for this entry.

  7. Open the Global Menu (Global Menu), go to the Control Panel tab, and click D4B8 Application Evaluations.

  8. Click Add D4B8 Application Evaluation to create an evaluation for the application.

  9. In the Application to Evaluations field, select the application you created. It is identified by the Business Name field.

  10. Fill out the evaluation form and click Save.

  11. Return to the Application Evaluations overview page and verify the entry appears in the table.

    The evaluation entry appears in the Application Evaluations menu.

    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.

    The Evaluation Notes tab displays evaluations related to the application.

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,

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

  2. Click the Distributor Applications folder.

  3. Click View in Model Builder.

  4. Look for the D4B8 Distributor Application object, click Add Field or Relationship, then select Add Field.

  5. Enter these values and click Save:

    FieldValue
    LabelBusiness Other Brands Offered
    Field NamebusinessOtherBrandsOffered
    TypeLong Text
    Enable Entry TranslationFalse
    MandatoryFalse

    Clicking Add opens a panel to create a new custom field.

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,

  1. Click Actions (Actions Button) for D4B8 Distributor Application and select Edit in Page View.

  2. When prompted, select Open Page View.

  3. Go to the Layouts tab and click Application Layout.

  4. Go to the Layout tab.

  5. Find the Business Details block and click Add Field.

    The Business Details can be found under the Application tab.

  6. Select Business Other Brands Offered as an option, choose the single column box for the field size, and click Save.

    Clicking Add Field opens a panel to include a field to the block.

  7. 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,

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

  2. Select D4B8 Product Types.

  3. Click Add and create these items:

    NameKey
    Eyeglasseseyeglasses
    Sunglassessunglasses
    Lenseslenses
    Contactscontacts
    Otherother
  4. Click each item and replace their External Reference Code with these values:

    NameExternal Reference Code
    EyeglassesPRODUCT_TYPE_EYEGLASSES
    SunglassesPRODUCT_TYPE_SUNGLASSES
    LensesPRODUCT_TYPE_LENSES
    ContactsPRODUCT_TYPE_CONTACTS
    OtherPRODUCT_TYPE_OTHER

    All picklists should appear after adding them.

  5. 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,

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

  2. Select the User role and go to the Define Permissions tab.

  3. In the left menu, go to Control PanelObjectD4B8 Distributor Applications.

  4. 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

    The User role should be able to create, read, update, and delete applications.

  5. Click Save.

  6. Verify the User role has the desired permissions.

    All permissions are assigned to the User role after configuration.

    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.

  7. Return to the Roles overview page and select D4B8 Business Development Manager.

  8. Go to the Define Permissions tab.

  9. In the left menu, go to Control PanelObjectD4B8 Distributor Applications.

  10. 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

    All permissions are assigned to the Business Development Manager Role after configuration.

  11. 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:

Capabilities

Product

Contact Us

Connect

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