Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

AddInstance duplication


Level 1

Good day,

I have a form which I duplicate a section of content.  This section has a few tables within it.  One of the sections gives the user the ability to add new action items.  The user also has the ability to create a new batch of objectives which essentially copies the entire table without content.  The issue I am having is that when the user copies the entire table, the new duplicated table looses the functionality to add new action items as the button adds action item rows to the initial table instead.  Any thoughts?  You can download the PDF here: http://illusionnewmedia.com/AchievePDF_Jan2018.pdf as it would make more sense seeing it.

Much appreciated,


3 Replies


Level 7


I havent looked at the form, but it sounds like your add button is outside the table. Put it inside and that might do it.

Failing that, you will need to reference the specific instance. The first visible table instance will be [0], the second [1], third [2] and so on. Plenty in the help about instances. You will need to create logic of some sort to handle your situation.

You can reference the instance manager to add some logic like if (mytable.instanceManager == "2") {mytable[1]....add row code}


Here is an example of specific referencing to make it easier to understand...i hope.

Note: toCore, toSupporting, SuppDesc and textToMove are all TextFields

You can see how the instance number is changing in each case to send the textfield rawvalue to a different instance of SuppDesc. Which instance if goes to is based on the rawValue of the toSupporting TextField.

if(this.resolveNode("toCore").rawValue == "1")
case 1:
this.resolveNode("form1.#subform[0].Project.Core[0].Supporting[0].SuppDesc").rawValue = this.resolveNode("textToMove").rawValue;

case 2:
this.resolveNode("form1.#subform[0].Project.Core[0].Supporting[1].SuppDesc").rawValue = this.resolveNode("textToMove").rawValue;

case 3:
this.resolveNode("form1.#subform[0].Project.Core[0].Supporting[2].SuppDesc").rawValue = this.resolveNode("textToMove").rawValue;





Level 1

Thank you for your feedback, I appreciate you taking the time.  It looks like I just needed to duplicate the subform and not the table itself.  Again, thank you!