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.
Define your InfoPath form
- Click “Design a Form Template”
- XML or Schema
- Browse to your XSD that you developed in Visual Studio
- Drag and Drop the fields from the right hand side onto your form. You then can work on making the UI pretty.
- What can I say, I am a BizTalk developer not a Silverlight/WPF developer
Publish your form
- Publish this form to your SharePoint document library by clicking on the “Publish Form Template”
- Select “To a SharePoint server with or without InfoPath Forms Services” and click “Next”
- 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.
- I want to publish the form as a “Document Library”.
- Select “Create a new document library” and click “Next”. I called my Document Library “Field Incident Reporting Forms”.
- 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.
- Document Library has been published
- Click on the “New” button and you will find that the Field Incident Entry Form is automatically displayed.
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.
- Drag the “Button” control and drop it in the appropriate place on the form.
- Right mouse click on the button and select “Button Properties”
- Change the “Label” to “Submit”
- Click on “Rules” button
- Modify the “Name” and click on “Add Action”
- Pull the “Action” drop down and select “Submit using a data connection” and click “Add”
- “Create a new connection to:” ->“Submit Data”
- Select “To a document library on a SharePoint site” and click “Next”
- 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.
- Click on “Insert Function”
- Select the “concat” function and click “Ok”
- 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.
- 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.
- Click “OK” to continue
- I called my data connection “Submit Field Incident Form” and click “Finish”
- Click on “Ok”
- 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.
- Expand the options by clicking on the “Advanced” button, select “Close the form” from the “After submit” pull down and click “OK”.
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”
- Populate the form and click the “Submit” button
- A confirmation message indicating that the Form has been submitted will appear and the form will close.
- 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.
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.
- Document is pulled from SharePoint and sent to the folder that is specified in the Send Port configuration.
- 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.
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…