Using BCS Data in External Data Column - Share Point 2010

We’ve now successfully created connections to our sample ERP system and an external web service that can be used to retrieve web results relating to competing products. With these connections in place, our next step in completing the user interface for our application is to define a new document library in which to store competitive analysis documents.

  1. Using Internet Explorer, navigate to our sample SharePoint site. Then, from the Site Actions menu, select New Document Library. In the dialog that appears, typethe name of the document library: Competitive Analysis. Click Create to continue.
  2. Make sure that the Library menu is visible in the ribbon, and then select Library Settings.
  3. To add an External Data Column that can be used to select a product to associate with the Competitive Analysis document, click Create Column.
  4. Set the name of the new column to Model; then select the External Data type.
  5. In the Additional Column Settings section, in the External Content Type Picker, enter Model. Then click the Verify button (with a checkmark) that appears to the immediate right of the text box, as shown here:
  6. Using BCS Data in External Data Column

  7. From the drop-down labeled Select The Field To Be Shown On This Column, choose Name. As well as the Name field, we also want to include Modified Date as a field in our list. Select this from the list of additional fields.
  8. Click OK to create the new column.
  9. Repeat steps 3 to 7 to add a link to the web-based content. This time, name the column Competing Model. Set the External Content Type to WebResult. Show the Title field in the column and include the Date Time field.

With these new columns in place, we’re ready to start uploading or creating documents. As you’ll see when you upload a document, you are prompted to select a Model and a Competing Model before you can save the document. In both cases, you can make use of the External Picker Control to select the item from a list.

Once your document is saved to the document library, you’ll notice that additional fields have been carried through from the external content type, such as Model: Modified Date and Competing Model: Date Time.

NOTEAt the time of writing, creating External Data Columns is not supported using SharePoint Designer 2010 Beta 2.

Profile Pages
By using External Data Columns, you can easily combine data from external systems with SharePoint-generated data, allowing for data consistency throughout your applications. But what happens when you want to drill down into the data that’s associated with External Data Column? The answer is profile pages. This feature is available in SharePoint Server 2010 only, and before it can be used, it must be configured via SharePoint 2010 Central Administration. Let’s do that now:

  1. Open SharePoint 2010 Central Administration. In the Application Management section, select Manage service applications.
  2. From the list of Service Applications, select Business Data Connectivity with type Business Data Connectivity Service Application.
  3. On the Service Application Information page, select Edit from the top menu to show the Edit ribbon. Then select Configure.
  4. Check the Enable Profile Page Creation checkbox.

Profile Pages

NOTEAs you saw, service applications can be shared between multiple applications. Generally where profile pages are being used by multiple sites, a dedicated site to host the pages will be set up. For the sake of simplicity, we’ve used our demonstration site, but this is not indicative of best practice. Now that we have the facility to create profile pages, we need to do the work to create a page for our Model external content type. Using SharePoint Designer, this is simple:

  1. In SharePoint Designer, navigate to the Model External Content Type.
  2. From the ribbon, select Create Profile Page.

That’s all there is to it. A new profile page has been created that will be automatically linked to our Model content type wherever it appears in lists. To see this in action, navigate to the Competitive Analysis document library that we created earlier. You’ll notice that items in the Model column are now hyperlinks instead of plain text. Clicking the hyperlink will take you to the auto-generated profile page for that item.

The profile page presents a read-only view of the entity together with any associated entities. In this case, you can see the Model together with any Products that are based on the model. As mentioned earlier, the profile page is generated using External Data Web Parts and as such can be customized further to meet specific requirements.

For example, in the Model profile page, let’s say we wanted to hide the rowguid and ProductModelID columns. By selecting Edit Page from the Site Actions menu, and then editing the properties of the Business Data Item web part, we can easily hide these fields..

Default Actions on External Content Types
I’m sure you’ll agree that profile pages are pretty useful stuff. Not only can we easily attach data to our SharePoint lists and libraries using BCS, but with a few mouse clicks we can generate a customizable user interface that can be used to drill down into that data.

But how does it work? What is it that connects the content type to the profile page? What if the external system is web-based and we want to link to a page there instead? What if we’re using SharePoint Foundation 2010 and don’t have the profile pages feature?

It’s all about actions and in particular the Default Action that’s been defined for our External Content Type. The BDC model allows multiple actions to be defined for each entity, where an action is basically a parameterized URL that can be used to connect to an external system or to redirect to a page within the SharePoint site, as is the case with profile pages. Once actions have been defined, they are available wherever the content type is presented. As we saw earlier, for example, actions are automatically attached to External Data Columns.

If we look back to our Competitive Analysis document library, one of the things we can see is that no actions are defined for our WebResult content type. By clicking the icon to the left of the text in our Competing Model column, you can see that no actions are available on the context menu.

Since our WebResult content type represents a web page, it would be useful if our default action was simply to connect to the associated web page. We can make this change in Visual Studio 2010, as follows:

  1. Open the BingConnectivity project. In the Solution Explorer pane, right-click the BdcModel1.bdcm file, and then select Open With. From the list that appears, select XML Editor.
  2. At the time of writing, the SharePoint BDC Designer tool in Visual Studio doesn’t support the creation of actions, so we need to edit the underlying metadata file directly. Make the highlighted changes:
  3. Deploy the updated metadata by selecting Deploy BingConnectivity from the Build menu.

Now when you reload the Competitive Analysis document library, the Competing Model column is hyperlinked. Clicking the link takes you to the URL originally returned from our Bing search.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Share Point 2010 Topics