ナレッジベース
公開されました Jan. 12, 2026

How to Access Nested Freemarker FieldSets in DXP 7.4+

written-by

Jose L. Bango

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.

Issue

  • After upgrading to Liferay DXP 7.4+, FreeMarker templates appear to access fields within existing web content structures using different syntax than newly created web content structures. For example, older structures allow direct access to nested fields, while new structures require referencing a parent Field Group. 
  • How can I configure new structures to reference nested or repeatable fields within templates?

Environment

  • Liferay DXP 7.4+

Resolution

In Liferay DXP 7.4+, a backward compatibility layer processes structure fields before passing them to FreeMarker templates. For older structures, this flattens variable names by removing the FieldSet suffixes, enabling seamless operations for legacy templates. For new structures created in DXP 7.4+, templates must instead explicitly reference the Fields Group. This results in nested loops similar to this example:

<#list myRepeatableField.getSiblings() as item>
  ${item.Fieldset_level1.myNestedField.getData()} 
</#list>

In contrast, old templates accessed fields directly. See this example:

<#list myRepeatableField.getSiblings() as item>
  ${item.myNestedField.getData()} 
</#list>

Because of this change, you should use the full, cascaded variable names provided by DXP 7.4+ when writing new templates. Also, explicitly reference the FieldSet variables in your template logic to ensure clarity and future maintainability. See this example with heavily nested fields: ${Fieldset_level1.Fieldset_level2.Fieldset_level3.myText.getData()}.

Workaround: Triggering Compatibility Mode

Alternately, you can manually trigger compatibility mode to reuse old templates within new structures. While you should plan to convert those templates to use the updated syntax, you can accomplish this workaround by configuring the Fields Groups' field reference to end with the FieldSet suffix. To do so:

  1. When creating a web content structure, create a Fields Group.

  2. In the field's advanced settings, set the Field Reference to a value that ends with FieldSet (e.g., myGroupFieldSet). Note: The Field Reference is not its Label.

  3. Add your nested or repeatable fields inside this group. Repeat this step for additional Fields Groups.

Liferay will process the structure through the compatibility layer, enabling you to access the nested fields directly in your FreeMarker template (as you would in older Liferay versions).

Additional Information

did-this-article-resolve-your-issue

ナレッジベース