I have created this blog to document some of the techniques/patterns/tricks that I have come across during some of my projects.
Monday, October 19, 2009
ShareTalk Integration Series - PDF Available
Here is a link to his post where you can find this PDF document.
Sunday, October 18, 2009
ShareTalk Integration (SharePoint/BizTalk) – Part 7 Adding Content Approval
In the last post, I showed you how to submit InfoPath forms to SharePoint and have BizTalk consume those forms once they were posted. This is great, but what if you need to have a supervisor approve the form before BizTalk consumes it? In this post we will use a feature in WSS 3.0 called “Content Approval” to mange the state that a document is in.
- Open up your Document library, click on “Settings” – >”Form Library Settings”
- Click on “Versioning settings”
- Ensure that you select “Require content approval for submitted items”, modify your security as required and then click on “OK”
- If you navigate back to your Document Library, you will notice a new column called “Approval Status”
- Notice that when you add a new form that it has a status of “Pending”. Also, if you haven’t done so disable your BizTalk receive location because BizTalk will not observe the status of the document – for now anyways.
- When you click on the pull down menu for the form, you now have an “Approve/reject” option – click it.
- Click on the “Approved” radio button, add a comment and click “OK”
- Notice now that the document has been approved and the Approval Status reflects this change.
- So if we want BizTalk to only consume forms that have been approved, how does this help us? What we can now do is create a “View” and then populate the “View Name” property in the BizTalk Receive Location.
- Click on the “All Documents” drop down and select “Create View”
- Click on “Standard View” link
- Provide the View with a name: “Approved Forms”
- Create a filter that indicates only to display items in this view when “Approval Status” is equal to “Approved” and click OK.
- Add another form to this library but don’t approve it. Now toggle between the “All Documents” and “Approved Forms”
- Modify your BizTalk Receive Location so that it will only pull documents from the “Approved Forms” view.
- Enable this receive location and you should find that only the “Approved” form is consumed. The “Pending” form should still be in the document library.
What really impresses me about building these scenarios is the depth of the Microsoft platforms. I haven’t been in Visual Studio much at all through this series. There is so much functionality that is available out of the box which makes these scenarios very quick to build.
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.
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.
- “Publish”
- Success
- 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
- “Add”
- 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
- “Next”
- I called my data connection “Submit Field Incident Form” and click “Finish”
- Click on “Ok”
- “Ok”
- “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…