The Form has been closed. Or has it?

Developing with forms services, especially with Workflow; usually turns out to be a love-hate affair - it has enough twists and turns to put a bag of pretzels to shame. One of the most frustrating errors (gauged from the amount of "help needed!" posts in newsgroups) - the infamous "The Form has been closed" message, usually occurs to Workflow association, Initiation, or task modification forms. Upon closer inspection in SharePoint's log files, the most common message is:

"The specified form cannot be found".

If the workflow host (in this case, SharePoint) could not see your wickedly awesome form that you have spent the entire week developing, the first place to check is the worfklow xml file (workflow.xml, by default). We have all checked, double-checked, triple-checked the form URNs that was supposed to be the guy who will tell SharePoint how to locate our forms that has been uploaded from our workflow feature, but still it could not locate the forms!

One item of note is that we have to understand the difference when we "Save" a form template, and when we "Publish" them. Note that if you publish the form under a different name from the one that was saved, the Form URN is different between them. The URN that we need to specify should be the one that we publish.

Here's an illustration:

I created a form, and save it as "Test" in C:\. Subsequently, I published it as "Test Form" in C:\ again.

The Form URN for the saved form (if I did not close my InfoPath designer, and view the ID, this is what I will get):

And if I open the published form from C:\Test Form.xsn, this is the correct ID:

Cross check that against your workflow.xml, and you should have it ironed-out in no time :)

Additional tips: After deploying the workflow feature, you can find all the workflow-related forms uploaded from your Central Administration, Application Management, Manage Form Tempates -> Click on the form in question and view its properties. That will reveal the ID that will be "seen" by SharePoint.

If all else fails, here is a sure-fire way to determine your form's URN: rename the published form to .cab, double-click to open it. Extract the file manifest.xsf and open in notepad. Locate the xsf:xDocumentClass element that should be right at the top, and check the "name" attribute. This is your form's URN.