Consuming External Content Types(BCS) in InfoPath Forms


Business Connectivity Services(BCS) is one of the coolest features in SharePoint 2010.  BCS helps us connect to Line of Business applications without writing a single line of code.

In this article, we will explore the process to connect to BCS and use the information within an InfoPath form.  A business scenario would go something like this

“You need to create a Expense Report form.  Users entering expenses will need to pick a valid project from your Line of Business system within the InfoPath form”

Check out these articles on how to create the BCS model and connect to your Line of Business system

Tobias’s Article on BCS

Now that you have a BCS system, lets display those fields within an InfoPath form

In my example, I have a simple SQL Table with a list of projects as shown below

image

We need to build an InfoPath form where users can pick one of the projects from this list.

My external content type in SharePoint Designer looks like this below

image

Notice the following properties ‘coz you will need them when you build your form in InfoPath

Name, Namespace, External System

Open up InfoPath 2010 and design a blank form

In the Home Tab, Under the Controls section choose the External Item Picker option under the input sub section and add it to the form

image

InfoPath will add a new group to the data fields with some properties.

Add the Field to the InfoPath form, right click and pull up the Properties for the external Item Picker

image

Enter the Namespace of your ECT , Name of the ECT and the System Instance Name(in our case it is CRM) into the required fields. <edit>Enter the Display Name of your field, otherwise you would only the see the identifier when you preview the form..</edit>

Note: After two hours of frustration, I found this to help finding information about the system instance name.  There is no help for the required fields and at first I couldnt figure out what the “System Instance Name” was.  Is it the name of the Finder ? Is it the name of the Entity? .   A search on MSDN retrieved the following article

MSDN System Instance Article

The System Instance name is a property of the SPBusinessDataField.  So to find out the property, I added the same field to a custom list and wrote some code as follows to retrieve the System Instance Name

image

The system Instance name was the same name as the external system property in SharePoint Designer.

Click the Other Settings tab in Infopath and set the following properties.  Check the “Refresh on Open” option and select the dropdown for the picker mode to “Connect to external data through SharePoint”

image

Click Ok and Hit Form Preview. Now you can search for content in your LOB and surface them through InfoPath.  We will discuss saving this data to SharePoint in another post.

image
Advertisements
%d bloggers like this: