Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM dialog using sling:resourceType include on the same component dialog multiple times

Avatar

Level 2

Hi there,

I have a very similar issue that was posted on StackOverflow (see link below), but unfortunately, I was not able to find a solution yet.
https://stackoverflow.com/questions/68459743/aem-dialog-using-slingresourcetype-include-on-the-same-... 
How I can use the following in the same dialog multiple times?

<ctaLinks
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/include"
path="/apps/my_project/components/base/_ctagroup/content/items/ctaLinks"/>  

Assume i have 2 Tabs, and I want to be able to use this generic / global ctaLinks in both tabs.
But when I use (the code snippet above) multiple times in dialog .content.xml,
cta button is duplicated, so Tab 1 and Tab 2 dialog config in new component is overriding each other's value.
So whenever I change the cta value in Tab 1, it also changes the cta value in Tab 2.

Your help is greatly appreciated. 

5 Replies

Avatar

Community Advisor

Hi,

 

Values getting duplicated because the name field is same in both the tabs as you are including same global/ctaLinks using path. 

 

Try using sling:resourceSuperType instead of path with that you can overwrite the name property in child node and have different names in tabs

Avatar

Level 2

@Ravi_Pampana thanks for the reply. Actually, I have tried it before as it was suggested in other similar posts. When I use sling:resourceSuperType instead of path nothing works. 

Avatar

Community Advisor

Name field needs to be unique

Himanshu Jain

Avatar

Level 2

@Himanshu_Jain thanks for the reply. Yes, the name field needs to be unique, but I don't think I can use the name field when I use include according to the granite ui doc below. Is it ever possible? Any suggestions? https://developer.adobe.com/experience-manager/reference-materials/6-4/granite-ui/api/jcr_root/libs/... 

Avatar

Employee Advisor

We all are aware that because of identical value of name property(field) you are facing this issue. 

Want to understand why are you planning to provide similar set of fields in both tabs from functional point of view?