Legacy Knowledge Base
Published Jun. 30, 2025

Accessing to Objects custom fields in an Aplication Diplay Template

Written By

Julián Vela Cubas

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • I'm configuring a search results ADT for a custom Object. By default I can choose, in the available variables, the title, author, etc. But I need to access custom fields of the Object as well.

Environment

  • Liferay DXP 7.4

Resolution

  • Search for the service endpoint in the API console ( /o/api ) on a web browser corresponding to the Object entity.
  • In the ADT make a call to the rest service using the "restClient" and the classPK as Id.
<#if entries?has_content>
<#list entries as entry>
<#assign myobject = restClient.get("/c/myobjects/${entry.getClassPK()}")>
field1: ${myobject.field1} <br>
field2: ${myobject.field2} <br>
field3: ${myobject.field3} <br>
</#list>
</#if>

 

Additional Information

  • Here is a recorded session with a live demo by Alejandro Tardín that explain perfectly how to implement this solution:

https://liferay.dev/twentyfour#Put%20your%20templates%20at%20REST

 

 

Did this article resolve your issue ?

Legacy Knowledge Base