You get the Merge Swatches popup because you have to swatches that don't match. eg. in template you may have swatch called "myRed" set to Spot colour, with CMYK of 0,100,100,0 and in active doc a swatch called "myRed" set to spot colour, with CMYK of 0,98,100,2 these will conflict. simple solution would be to rename swatch from template to "templateRed". if you need to then reduce the swatches something like,
thisDoc.pageItems['namedItem'].fillColor = thisDoc.swatches['myRed'].color;
swatchToDelete = app.activeDocument.swatches['templateRed'];
swatchToDelete.remove();
of course this assumes you know in advance exactly how the swatch is used.
... View more