<LabVIEW>\resource\plugins\CreateSubVI\Additional Actions Template.vi
This VI has (limited) instructions for how to run custom code when doing a Create SubVI action. You can search around for more details.
I don't know if you'll be able to use a template, though. You might have to do all of the scripting code.