How to Find Out What InfoPath Fields Have Changed
Ever get this message when you open an InfoPath form to edit?
One or more fields in the SharePoint list have changed. Do you want InfoPath to update the set of available fields? You may need to modify your form view to add or remove the updated fields.
Most of the time, you can just click Yes without repercussions. But there will come a time where there will be consequences for doing this. Ever wonder what fields have changed? And how? What fields have been added or deleted?
Turns out we CAN make an informed decision about whether InfoPath should update the fields. In order to do that, we need to compare the old form schema to the new form schema.
First of all, you will have to click ‘No‘ to that dialog box. Then go to File->Publish->Export Source Files and save the form as source files in a folder somewhere.
Then close the form, reopen it again and this time click ‘Yes‘ to the dialog box. Save this generated form as source files in another folder somewhere.
Use Notepad++ or any other compare tool to compare and enumerate the differences between the files that are generated. But you don’t have to compare all the files. Turns out the differences are contained in the manifest.xsf, some schema.xml and the choices.xml files.
The manifest files will tell you if there are any new or deleted fields or whether attributes of a field, such as being required, have changed for any fields.
Open the manifest.xsf file of the old form from the folder where you saved it and the manifest.xsf file of the new form from where you saved it in the tool of your choice. When you compare the two, you will see the differences highlighted as additional, deleted or changed <xsf:field> tags.
The differences will look something like this:
The choices.xml file will tell you if any values for any choice fields have changed.
While changes to the available values in a choice field are less problematic to your form than new, deleted or changed fields, there is still value in knowing what choice fields that have changed, even if it’s only to know that those are the only things that have changed.
The problem with comparing the choices.xml files is these files are created as one long unbroken string of XML with no spaces or carriage returns, so when you do a diff, all you get is a meaningless “this line is different” – not really helpful since all the XML is on the one line, you see.
In order to pinpoint where the changes were, I used a tool to help me reformat that XML. Dreamweaver will do it in a snap, but I found one for free in the firstobject XML editor, foxe. This editor will allow you to open the two choices.xml files and use the ‘Align” command under the Tools menu to align the xml into something you can understand. From there you can choose to visually inspect the files in foxe to see what has changed, or you can save the aligned xml files and then do a compare in Notepad++ or some other comparison tool. You will see the different choices highlighted as additional, deleted or changed <SharePointListChoice_RW> tags.
(You can click on the image to see it full sized.)
- When you really need to know (or are just curious) exactly what has changed in your SharePoint/InfoPath schema, you can save the different .xsns as their source files.
- You can compare the files with any file comparison tool.
- Manifest.xsf will show you attribute changes/additions/deletions of fields.
- Choices.xml will show you changes in available values for choice fields, but you may have to reformat the XML in the files to make them easier to compare.