Sunday, October 18, 2009

ShareTalk Integration (SharePoint/BizTalk) – Part 6 Form automation using InfoPath/SharePoint/BizTalk

You may have some scenarios within your organization where you have people filling out forms using pen and paper or perhaps using MS Word or Excel.  The result of both of these activities is that you usually have another person re-keying this information into the downstream system that actually needs this information.  As you can see this process is horrible inefficient.  Not only is there a lot of duplication of effort, but there may also be data quality issues if you are trying to read someone’s “chicken scratch” and then input that information into another form.

The purpose of this post is to explore some of the integration capabilities that exist between InfoPath/SharePoint/BizTalk. 

As I have mentioned in the past, I work in the energy industry.  We have many mobile workers who are out in the field and have durable laptops where they will manage their work orders, email etc.  These workers need to be able to get their “documentation” out of the way quickly so that they can focus on their jobs.  Using a tool like InfoPath aligns well with their productivity needs as it is easy to use and also supports online/offline capabilities since these workers generally make network connections from rural areas.

The POC that I am going to build is related to a Field Incident Form that can be used for mobile workers to populate when an incident has occurred in the field.  The incident could be related to environment issues such as an oil spill or an injury that has occurred.

Define your contract

Open up Visual Studio and model your schema.  By doing so, you will ensure that BizTalk, SharePoint and InfoPath are all “speaking” the same language. Once done, ensure you have saved your XSD as we will use it in the development of the InfoPath form.

 

image  

Define your InfoPath form

  • Click “Design a Form Template”

image

  • XML or Schema

image

  • Browse to your XSD that you developed in Visual Studio

image

image

  • Drag and Drop the fields from the right hand side onto your form.  You then can work on making the UI pretty.

image

  • What can I say, I am a BizTalk developer not a Silverlight/WPF developer

image

 Publish your form

  • Publish this form to your SharePoint document library by clicking on the “Publish Form Template”

image

  • Select “To a SharePoint server with or without InfoPath Forms Services” and click “Next”

image

    • Provide a link to your SharePoint Document library and click yes.  If you have issues with this, make sure that you have a root site i.e. http://server/ otherwise you will get an error.

image

  • I want to publish the form as a “Document Library”.

image

  • Select “Create a new document library” and click “Next”.  I called my Document Library “Field Incident Reporting Forms”.

image

  • Add any columns that you would like to be displayed in the document library.  The data that will be displayed comes from underlying XML that is captured in the InfoPath form.

image

  • “Publish”

image

  • Success

image

  • Document Library has been published

image

  • Click on the “New” button and you will find that the Field Incident Entry Form is automatically displayed.

image

image

 Enhance your form

  • I can have users save the InfoPath form into the SharePoint document library(via FILE –> SAVE AS), but I want to simplify the user experience. I am going to add a submit button to the form so that we can publish the form to SharePoint directly.  Click on the “Controls” button.

image

  • Drag the “Button” control and drop it in the appropriate place on the form.

image

  • Right mouse click on the button and select “Button Properties”

image

  • Change the “Label” to “Submit”

image

  • Click on “Rules” button

image

  • “Add”

image

  • Modify the “Name” and click on “Add Action”

image

  • Pull the “Action” drop down and select “Submit using a data connection” and click “Add”

image

  • “Create a new connection to:” ->“Submit Data”

image

  • Select “To a document library on a SharePoint site” and click “Next”

image

  • Previously, a Document Library called “Field Incident Reporting Forms” was created and this is where I would like to publish this form.  Next click the “fx” button as we will be able to use data from the InfoPath form to make up part of the file name that will be displayed inside of SharePoint.

image

  • Click on “Insert Function”

image

  • Select the “concat” function and click “Ok”

image

  • I am going to input a string literal of ‘Incident Form’ and then double click the “double click to insert field” link to choose a field from the InfoPath form.

image

image

  • Since I only want two elements of data, I am going to remove the last “double click to insert field link”.  Next I will click on the “Verify Formula” button to ensure I have a valid function call.

image

  • Click “OK” to continue

image

  • “Next”

image

  • I called my data connection “Submit Field Incident Form” and click “Finish”

image

  • Click on “Ok”

image

  • “Ok”

image

  • “OK”

image

  • If you want to have the form automatically close when the “Submit” button is clicked then right mouse click on the “Submit” button and select “Button Properties”.  Next, pull down the “Action” drop down and select “Submit”.  The “Submit Options” button should now appear and click it.

image

  • Expand the options by clicking on the “Advanced” button, select “Close the form” from the “After submit” pull down and click “OK”.

image

 

 Re-Publish your form

  • Once done, go through the process of publishing the form again so that when you click on the “New” button in the Document library that the version of the form that is launched has the “Submit” button included.
  • Navigate to you Document Library, click on “New” –> “New Document”

image

  • Populate the form and click the “Submit” button

image

  • A confirmation message indicating that the Form has been submitted will appear and the form will close.

image

  • You will now see a completed InfoPath form in your document library. Notice that data that was populated in the InfoPath forms is also displayed within the columns in the document library.

image

 

Configure BizTalk to consume these forms

  • All that I have done is modify the “Source Document Library URL” from Part 4 of this series. I continue to use the Send Port filter from Part 4 as well.

image

  • Document is pulled from SharePoint and sent to the folder that is specified in the Send Port configuration.

image

  • If I open up the document I will find that it matches my XSD specification that I established in the first step of this post.  Knowing that this message is typed, it is like any other message inside of BizTalk and can be transformed to match a specification of another system that will have a different format than InfoPath e.g. an ERP system.

image

 

In the next post of this series, I am going to build upon this scenario and add an approval process so that a supervisor could review the incident form before it is submitted to BizTalk.  Stay tuned…

3 comments:

Dipesh said...

Hi Kent,

I keep getting an error "The following URL is not valid.." when trying to publish my form.

I am using WSS 3.0? Is this supported for publishing infopath forms?

Also, I create the root site collection.
http://localhost:99/Homesite

I can access this site with the above url. But cannot access it with this one http://localhost:99. Could that be the reason? Any steps that I need to follow?

Dipesh

Kent Weare said...

You will still need to create a site off of the root http://localhost:99 even though you have already created http://localhost:99/Homesite


Yes you can publish InfoPath forms with WSS 3.0

Dipesh said...

Thanks Kent. Yah creating the root site solved the problem.

Much appreciated.

Dipesh