>Whenever I start developing SharePoint workflows there are always a couple of gotchas that get me. Unfortunately or should that be fortunately it is generally different things each time.
The current workflow that I am developing for a client is using Association and Initialisation Forms. Getting the association form to work took a couple of attempts, the major one being that each time I updated the solution, the forms themselves were not being updated which kinda didnt help as I was trying allsorts of things to solve it. Once the solution was deleted and readded in then the form started work.
“Great I thought” and then I actually tried to start a workflow and the dreaded Form has closed message quickly appeared.
Fortunately on a quick investigation of the ULS logs (c:\program files\common files\microsoft shared\web server extensions\12\logs) there was an entry from the Form Server Runtime. Which stated that the form could not be open successfully due to the following:-
SchemaValidationException, Exception Message: Schema validation found
Looking around on the web there wasn’t too much however I did find a post by Scot Hillier on creating a workflow with such forms. This pointed me to something that I wasn’t do and this is using Association Data. When you create an InfoPath project then a sampledata.xml file is created which gives a – yes you guessed it – a xml file with the sample default data from your form.
Using this I created an entry within workflow.xml called AssociationData. Using the sampledata.xml copy over the xml in between the AssociationData tags.
Redeploying the solution refreshed the InfoPath forms but the Initialisation form still failed to load.
Looking at the form schemas I realised that maybe it was due to the difference in the forms schemas. I updated each of the elements, each time there was no difference until finally I updated the root element schema name so that they are the same.
This solved the problem, on top of that it meant that I now only needed one serialization class to read the forms xml data! If you don’t know what I am talking about then please take a look at this MSDN post.