Adding the Relationship to Custom Layouts
Relationship fields appear automatically in an object’s default layout; relationship tables do not. To test the relationship, update the custom layout for Distributor Application to include the relationship table.
Here you’ll update the custom layout for Distributor Application to include the relationship table. Then you’ll create a custom layout for Application Evaluation that includes the relationship field.
Adding the Relationship Table to Distributor Application’s 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 Relationship Table.
-
Go to the Layout tab.
-
Click Add Tab, enter these details, and click Save.
Field Value Label Evaluation Notes Type Relationship Relationship Application to Evaluations -
Verify the relationship tab appears at the bottom of the layout.
Adding the Relationship Field to Application Evaluation’s Layout and View
-
Download and unzip the resources for this exercise:
curl https://resources.learn.liferay.com/courses/latest/en/application-development/modeling-data-structures/liferay-h2x9.zip -O
unzip liferay-h2x9.zip
-
Navigate to the
curl
folder in theliferay-h2x9
folder:cd liferay-h2x9/curl
-
Run this script to create a new default layout for Application Evaluations:
./ObjectLayout_POST_LayoutWithRelationship_ByExternalReferenceCode.sh
-
Verify the new layout appears and includes the relationship field.
-
Go to the Views tab.
-
Run this script to create a new default view for Application Evaluations:
./ObjectView_POST_ViewWithRelationship_ByExternalReferenceCode.sh
-
Verify the new view appears and includes the relationship field.
Now you can practice relating object entries!
Next: Relating Object Entries