Hi,
to be honest: You coding isn't great but overcomplicated. Why do you use the this.resolveNode() method? It's lazy and not needed when the elements in the hierarchy (subforms, fields etc.) are named well.You just have to image the location to the object that executes the script relative to the objects to be took into account by this. For example: tblWC1 and the buttons are very close together, just one level apart.

Instead of using resolveNode starting at the button (this) to then reference to the its parent parent "subContractor" and then refer to the instanceManagager (_) of its child element (tblWC1)
this.resolveNode('subContractor._tblWC1').addInstance(1);
if (xfa.host.version < 😎 {
xfa.form.recalculate(1);
}
this.resolveNode('Table1._subcontractor1Total').addInstance(1);
if (xfa.host.version < 😎 {
xfa.form.recalculate(1);
}
… use the shortes possible reference indead.
_tblWC1.addInstance(true);
The some for the remove button. Use the shortest possible script.
_tblWC1.removeInstance(_tblWC1.count - 1);
You also using code to solve problems with Acrobat Reader 7 from 20 years ago. You don't need this since 2006 so get rid of it.
// Only for Acrobat 7 and before
if (xfa.host.version < 😎 {
xfa.form.recalculate(1);
}
Do this for all subseqent work code elements of your form to make it work.
Tipp: The script object "ColorFieldValitation" by default has an issue and often fails in the background with the error "oOriginalNode is null" "49:XFA:form1[0]:validationState" which also slows down your form.
To fix this, edit the script object starting in line 41 and replace …
var oOriginalNode = xfa.resolveNode(sSOM);
var oOriginalAssist = oOriginalNode.assist;
if (!oOriginalAssist.isPropertySpecified("toolTip")) {
var oToolTip = oInvalidNode.assist.toolTip;
oInvalidNode.assist.nodes.remove(oToolTip);
}
with …
var oOriginalNode = xfa.resolveNode(sSOM);
if (oOriginalNode !== null) {
var oOriginalAssist = oOriginalNode.assist;
if (!oOriginalAssist.isPropertySpecified("toolTip")) {
var oToolTip = oInvalidNode.assist.toolTip;
oInvalidNode.assist.nodes.remove(oToolTip);
}
}