The InfoPath story: Chapter 4: the path to deployment (part 1)

So, the foundation is there, we have our fields/ content types and lists. Now it’s time to create and make the InfoPath forms deployable.

Let’s go:

First, we need to “design” the forms… by default the new form of the item looks like the picture below, so a normal SharePoint new form.

OldNewForm

 

If you are getting an error in rendering the InfoPath form “The form cannot be rendered. This may be due to a misconfiguration of the State Service.

Than follow the instructions on this blog.

After some fun with the InfoPath designer, the form can look like this. Much better no?

NewClientform

 

So what does SharePoint do in the back-end to make this work?

  • it first creates (or uses) a folder on the lists directory, so you have “lists / list name / content type name / InfoPath pages”

OldAspx

 

  • In this directory (content type name) you can find 3 .aspx files and an InfoPath .xsn file

Newaspx

And these are the files that make up your InfoPath in browser form.

If you are now thinking that deployment is easy and you just need to create these files in the correct location and stuff… well think again..

Even if you put these files in the correct location AND you manage to change the hardcoded list ID’s in the InfoPath form than the SharePoint list will simple ignore this. The list needs to be told to use the InfoPath forms from now on, otherwise it will not use it.

Second problem is, how are you going to get the template.xsn? You can get it by going directly to the link and downloading the file. But are you going to do this for 80 lists? I guess the answer is no (or maybe)…

So I’ve created a small “admin” webpart to make your life easier. It checks if the file exists. If so than the template.xsn is downloaded to a document library (if the library does not exist than it’s being created) and renamed to the list-CTname.xsn .

So how does it all work?

When you click on the “customize form” button to generate the InfoPath form than a lot of stuff is happening in the back-end.

  • InfoPath is opened
  • some soap calls are being done to the lists.asmx and formservices.asmx

If we look at what happens via fiddler than you can see there are calls that are being done to the web services.

NewIPformWebServices

But these calls are when the InfoPath is being opened, we need to look at the calls that are being done when we are saving the InfoPath form to the list.

Leave a Reply

Your email address will not be published. Required fields are marked *