I'm working to upgrade a browser based InfoPath 2010 form in a SharePoint library with tonnes of filled out copies of the form.
The form design needs to change rather drastically and I need to handle the case where an old version of the form opens, is upgraded, and legacy data is lost due to changes in the schema from the upgrade.
I have done a fair bit of research and think that the best option would be to use the FormEvents_VersionUpgrade function to copy values from legacy nodes to new nodes on version upgrade (to avoid data loss). However, I quickly ran into a problem with my code just trying to do a test SetValue to one of my new nodes (AllReq).
Receiving an error 5337 "Object reference not set to an instance of an object".
Here's my code:
public void FormEvents_VersionUpgrade(object sender, VersionUpgradeEventArgs e)
{
XPathNavigator xMain = MainDataSource.CreateNavigator();
XPathNavigator AllReqPath;
AllReqPath = xMain.SelectSingleNode("//my:AllReq", NamespaceManager);
if (AllReqPath.Value == null)
{
AllReqPath.SetValue("xxxxxxxx");
}
}
Any assistance would be greatly appreciated!
ps is there a way to handle version upgrade with Qrules?
Phil