Relating Object Entries

After defining an object relationship, you can relate entries in two ways: the Liferay UI or relationship REST APIs. Here you’ll practice relating evaluations and applications via the UI.

Adding Test Data

  1. Download and unzip the resources for this exercise:

    curl https://resources.learn.liferay.com/courses/latest/en/application-development/modeling-data-structures/liferay-g2n9.zip -O
    
    unzip liferay-g2n9.zip
    

    This includes two scripts for creating application and evaluation entries.

  2. Navigate to the curl folder in the liferay-g2n9 folder:

    cd liferay-g2n9/curl
    
  3. Run this command to create three entries for the Distributor Application object:

    ./DistributorApplication_POST_Batch.sh
    
  4. Verify the entries appear in Distributor Applications:

    Verify the entries appear in Distributor Applications.

  5. Run this command to create three entries for the Application Evaluation object:

    ./ApplicationEvaluation_POST_Batch.sh
    
  6. Verify the entries appear in Application Evaluations:

    Verify the entries appear in Application Evaluations.

Now relate these entries.

Relating Entries

  1. Begin editing an Application Evaluation entry.

  2. Select a value for the Application to Evaluations field. Available options for the relationship field include all applications you have permission to view.

    By default, application entries are identified by their IDs.

    By default, application entries are identified by their IDs.

  3. Open Objects and begin editing the Distributor Application definition.

  4. Set the Title Field to Business Name and click Save. This determines the field used to identify object entries in relationship fields.

    Set Title Field to Business Name and click Save.

  5. Return to Application Evaluations and begin editing an entry.

  6. Select a value for the Application to Evaluations field. Notice that applications are now identified using the business name field.

    Applications are now identified using the business name field.

  7. Open Distributor Applications and begin editing an entry.

  8. Go to the Evaluation Notes tab.

  9. Click Add (Add Button) and select from existing application evaluations.

    Select from existing application evaluations.

    The relationship table uses the ID and title field to identify each related evaluation.

    The relationship table uses the ID and title field to identify each related evaluation.

  10. Update the title field for the Application Evaluation definition to Author.

  11. Return to Distributor Applications and notice that the relationship table now uses the ID and Author fields to identify related evaluations.

    The relationship table now uses the ID and Author fields to identify related evaluations.

Conclusion

Congratulations! You have successfully modeled the necessary data structures for Delectable Bonsai’s distributor onboarding flow. Now you can start incorporating the business logic necessary for bringing your application to life, such as workflows, validations, notifications. You’ll do this in the next module.

Module Two: Implementing Business Logic

Relevant Concepts

Ask

Capabilities

Product

DXP

Contact Us

Connect

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