SharePoint 2007 (MOSS/WSS) how to change the template link within a InfoPath Form under a Form Library to point it to a New Form Template - Part 2 (few findings)
If you keep the fields (text field, drop down list etc) in separate sections within the Form Templates, then the previously mentioned changing link to the template does not work properly. It only works if you keep the fields directly in the form without using any group/section in all the templates.
The previous code given is for a web part, but the same logic can be used in an Item Event Receiver Assembly or in a Workflow also. In this way you can ensure the link gets changed automatically whenever a new item is added to the Form Library.
There is option for "SPListItem.ContentType.DocumentTemplateUrl" also. But it did not work as expected for me. That is why I have used "SPList.ContentTypes[i].DocumentTemplateUrl" in the code.