Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Include new fields in Experience Fragment v2

Avatar

Level 2

Good afternoon everyone!


I'm working with the Experience Fragment V2 lib and I need to include two new fields, one called "Id" and the other "Audience".

Both should appear in the "Experience Fragment options" dialog box.


Would you like some help or advice on how to do this?

3 Replies

Avatar

Community Advisor

Hi @Joelcio,

You need to customize the dialog of the component by overlaying it.

1. Overlay the Dialog

Copy the Experience Fragment V2 component from /apps/core to your project’s /apps/your-project/components/experiencefragment path:

/apps/core/components/experiencefragment/v2/experiencefragment
→
/apps/your-project/components/experiencefragment

Make sure you're copying the cq:dialog node from the experiencefragment component.

2. Modify the Dialog

In the cq:dialog XML (or .content.xml) file, locate the "Experience Fragment Options" tab. This typically uses a granite:Form with tabs and fields inside.

Add two new fields under the correct tab:

<id
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    fieldLabel="Id"
    name="./id" />

<audience
    jcr:primaryType="nt:unstructured"
    sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
    fieldLabel="Audience"
    name="./audience" />

Place these within the correct tab content node (likely named something like experienceFragmentOptions).

3. Save the Fields in the JCR

Ensure the name="./id" and name="./audience" attributes are used so values are persisted in the JCR under the component's content node.

4. Read the Values in the HTL or Java Model (Optional)

If you're rendering or using these fields on the frontend or backend, make sure to include them in the model:

@ValueMapValue
private String id;

@ValueMapValue
private String audience;

And expose them via getter methods in your model.

Hope that helps!

Santosh Sai

AEM BlogsLinkedIn


Avatar

Level 2

Hi, @SantoshSai !

Thanks for your help!

Your solution works well but I am work in Hedless model and my model.json doesn't brings the variations.

Could you help me with this problem?

Avatar

Level 4

Hi @SantoshSai,

 

Coud you please help @Joelcio with the follow up query?