Legacy Knowledge Base
Published Sep. 10, 2025

TemplatePortletPreferences.reset() is not available

Written By

Daniel Couso

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

  • A Web Content Template from previous versions with the following code is rendered:
<#assign journalArticlePreferencesMap = {
  "portletSetupPortletDecoratorId": "barebone",
  "groupId": "54321",
  "articleId": "12345"
  }/>

<#assign journalArticlePreferences = freeMarkerPortletPreferences.getPreferences(journalArticlePreferencesMap) />

<@liferay_portlet["runtime"]
defaultPreferences="${journalArticlePreferences}"
instanceId="myEmbeddedContent"  
portletProviderAction=portletProviderAction.VIEW
portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"    
/>

<#assign VOID = freeMarkerPortletPreferences.reset() />
  • But, the following error is shown:
The following has evaluated to null or missing:
==> freeMarkerPortletPreferences.reset  [in template "20101#20128#36309" at line 16, column 17]

----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign VOID = freeMarkerPortletPrefe...  [in template "20101#20128#36309" at line 16, column 1]

Environment

  • Liferay DXP 7.2+

Resolution

  • The error is thrown because the method reset from TemplatePortletPreferences class is no longer available in Liferay DXP 7.2 and higher.
  • Some users used to call this method to change their portlet's preferences on the fly without having to reconfigure it via UI.
  • If they want to continue to get this effect, as a workaround, they could change the value of the attribute instanceId to a value based on the article ID.

Additional Information

 

Did this article resolve your issue ?

Legacy Knowledge Base