Legacy Knowledge Base
Published Jun. 30, 2025

Retrieve display page template configured in web content article

Written By

Jose Bodega

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

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

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

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

Issue

  • The goal is to retrieve, via Liferay's API, when a web content article is associated with a Display Page Template.

Environment

  • Liferay DXP 7.4+

Resolution

  • Attached is a Groovy script as an example, through which the display page template associated with a particular web content would be retrieved. It only uses the following API services:

    • JournalArticle
    • AssetDisplayPageEntry -> this latter is the service that provides access to page templates associated with any type of asset, particularly web contents
  • import com.liferay.journal.service.JournalArticleLocalServiceUtil
    import com.liferay.asset.display.page.service.AssetDisplayPageEntryLocalServiceUtil
    import com.liferay.journal.model.JournalArticle
    import com.liferay.asset.display.page.model.AssetDisplayPageEntry
    JournalArticle journal=JournalArticleLocalServiceUtil.fetchArticle(X)
    classnameid = com.liferay.portal.kernel.service.ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class)
    AssetDisplayPageEntry aseetEntry=AssetDisplayPageEntryLocalServiceUtil.fetchAssetDisplayPageEntry(journal.getGroupId(),classnameid ,journal.getResourcePrimKey())
    out.println(aseetEntry.getLayoutPageTemplateEntryId());
  • Particularities:
    • In the first part, a normal web content is retrieved by its ID; In this case, we have used 'X'.
    • Using the AssetDisplayPageEntryLocalServiceUtil API with the parameters obtained from the previous Journal, it coud be obtained the associated AssetDisplayPageEntry model, which contains a LayoutPageTemplateEntryId field. This field would contain the identifier of the page template associated with the asset or 0 in case it doesn't have one.

 

 

Did this article resolve your issue ?

Legacy Knowledge Base