Dynamics CRM Enterprise Search Accelerator, Part 2
Using the BDC in SharePoint
Once you’ve got the application definition file properly imported into your MOSS 2007 Shared Services Provider, using it within SharePoint is pretty easy. (again, this assumes you have some familiarity with SharePoint, know how to edit pages and use Web Parts! Apologies in advance if you don’t, but to keep the article to a reasonable length, I’ll assume that kind of knowledge). First I’ll go through a basic exercise of using two Business Data Web Parts to create a custom SharePoint page with a list of CRM Account records, and a related list of CRM Contact records. After that, I’ll show you how to create a custom “Action” so that a SharePoint user can select an Account and pop open a Google map window based on that Account record’s address information. I like this example since it’s actually a little easier to do that using this approach than it is using the pure-CRM approach where you need to write Jscript code for similar functionality.
Using the BDC Web Parts to Display Accounts and Related Contacts
If you work through this example you should be able to easily generalize this to other situations, but I’ll start with the “least common denominator” of Accounts and Contacts.
1. Create a new page within SharePoint. Make sure it’s a page layout that supports Web Parts!
2. On one of the Web Part zones, click Add a Web Part.
3. From the Add a Web Part dialog, scroll down until you see the Business Data Web Parts section, and select the Business Data List. You can actually add more than one web part at the same time, so to save a little of that here, I’ll add both the “List” and “Related List” Web Parts at the same time:

4. After you add them to your page you’ll see something like this:

5. Click Open the tool pane to configure them, one at a time. The first thing you’ll need to do is identify which CRM entity you’re going to point each web part to – the first thing in the tool pane is the “Business Data Type Picker” you use for this. I usually browse out to see the entities that are exposed and you can see familiar CRM entities in the following figures as I go through this process:

6. First I’ll select Account, then Contact. Once I’ve got them selected and on the page, notice there’s an Edit view button available. Use this to deselect some of the fields (attributes) so that you don’t have to scroll all the way across the SharePoint page. I won’t go through all the details of that, but here’s what it looks like after I’ve deselected a lot of the fields, and customized the properties to only display ten records at a time:

7. Remember I said I wanted to select an Account record, and then be able to see all of the related Contact records. The web parts do most of the work for us, since they are defined as “Connected” web parts, and I can use the web part UI to pass a selected item from the Account List Web Part to the Contact Related List Web Part, as this figure shows:

8. Finally, what does it look like to a user? After locking those configurations in and taking our page out of edit mode, it might look something like this:

You can see I’ve got an Account record selected, and the three Contacts associated with that account are displayed in the Contact Related List web part. (I’d probably drop the ID columns before declaring this to be “in production”.) Notice the pull-down Edit menu in SharePoint, exposing commands like Create Account in MSCRM, and Edit Account in MSCRM. Those are so-called Actions. In the next section I’ll show you a cool and promising extension of the basic functionality: creating custom Actions. The View Map command you can see above is one of these and as I said…we’ll look at that next!
Creating Custom Actions
In the previous figure, everything except “View Map” is an out of the box Action pre-defined within the BDC application definition. One of the coolest things about the BDC is that you can define your own custom actions, and for actions that involve navigating to a URL and passing CRM data into the URL, you can do it entirely within the SharePoint UI, once again with no code required.
To illustrate this, I’ll go back to my Shared Services Provider, and navigate into the BDC application definition for my Account entity. I’ll navigate to the View Entity page for Account, and scrolling all the way to the bottom I’ll see something like this:

Look at that maps.google.com URL. If all you do is open a browser and navigate to google maps and enter an address in the Google search box, you get the same results as if you directly enter an address like this in the browser address box:
http://maps.google.com/?q=1415 west 22nd street oak brook il
This means that the google maps functionality is easy to construct a URL for, since it’s pretty forgiving, and doesn’t care much about spaces or quotes or things like that. So all you need to do to construct the custom Action so that users can do this without having to worry about typing anything is click the Add Action button, and specify the parameters you want to pass in to the URL, and how they correspond to Dynamics CRM fields:




Brought to you by Richard Knudson and IMG.
Hello DCRMUGers! Said,
April 15, 2009 @ 12:43 pm
[...] Enterprise Search Accelerator for Dynamics CRM, part 2 (using it from inside SharePoint) [...]
Prashant Raut Said,
May 28, 2009 @ 7:01 am
Nice article.I have some doubt for connecting CRM datbase. I need to import all the users from FilteredContact view into sharepoint user profile using BDC ADF. In the DB connection setting of BDFC ADF i want to SQL server authentication user name and password. CRM DB doesn’t allow to read the data if user is not in CRM roles, but my requirement is to access CRM data directly from CRM DB views.
Paul Slager Said,
November 4, 2009 @ 1:24 pm
Hi I am having some trouble getting this to work correctly.
I made the edits that you suggested to the BDC Xml file and was able to import the application into SharePoint. When I try to create the webpart i am able to use the picklist to find the values I want, I choose opportunity, contacts, and cases non of them work. The error I get is could not connect to Microsoft Dynamics CRM.
CRM is a two tier setup the application is on a server called “CRM” the database is on a server called “SQL”
SharePoint is on a server called “SharePoint”
My hunch is I need to edit something else in the XML file.