TouchUI dialog not saving multifield data properly in Sling Model | Community
Skip to main content
Level 2
November 5, 2025
Solved

TouchUI dialog not saving multifield data properly in Sling Model

  • November 5, 2025
  • 1 reply
  • 187 views

Hi everyone,

I’m working on an AEM component that uses a nested multifield inside a coral3 TouchUI dialog, but the data doesn’t seem to map properly to my Sling Model.

Here’s my dialog XML:

<dialog
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:granite="http://www.adobe.com/jcr/granite/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Team Members"
helpPath="en/cq/current/wcm/default_components.html#Text"
sling:resourceType="cq/gui/components/authoring/dialog">

<content jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<members
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
fieldLabel="Team Members"
composite="{Boolean}true"
name="./members">

<field jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<name
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Name"
name="./name"/>
<role
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="Role"
name="./role"/>
</items>
</field>
</members>
</items>
</content>
</dialog>
And here’s the Sling Model:

@Model(adaptables = Resource.class)
public class TeamComponent {

@586265
@Optional
private List<Member> members;

@Model(adaptables = Resource.class)
public static class Member {
@586265
private String name;

@586265
private String role;

public String getName() { return name; }
public String getRole() { return role; }
}

public List<Member> getMembers() {
return members;
}
}

When I add multiple entries in the dialog and check in CRX, the data looks fine under ./members, but my List<Member> in the Sling Model is always null.

I tried using @ChildResource instead of @586265, but then I only get one entry or sometimes an empty list depending on how I open the dialog.

Best answer by SantoshSai

Hi @aryaba1,

AEM stores composite multifield data as child resources, not as properties.

Try this;

@Model(adaptables = Resource.class) public class TeamComponent { @ChildResource(name = "members") @Optional private List<Member> members; public List<Member> getMembers() { return members; } @Model(adaptables = Resource.class) public static class Member { @Inject @Optional private String name; @Inject @Optional private String role; public String getName() { return name; } public String getRole() { return role; } } }

1 reply

SantoshSai
Community Advisor
SantoshSaiCommunity AdvisorAccepted solution
Community Advisor
November 5, 2025

Hi @aryaba1,

AEM stores composite multifield data as child resources, not as properties.

Try this;

@Model(adaptables = Resource.class) public class TeamComponent { @ChildResource(name = "members") @Optional private List<Member> members; public List<Member> getMembers() { return members; } @Model(adaptables = Resource.class) public static class Member { @Inject @Optional private String name; @Inject @Optional private String role; public String getName() { return name; } public String getRole() { return role; } } }
Santosh Sai
AryaBa1Author
Level 2
November 5, 2025

@santoshsai thank you this does worked.