With Business Connectivity Services in SharePoint 2010, you are able to use Microsoft SharePoint 2010 Search to connect to external data, such as your Microsoft Dynamics CRM 2011 database. The Business Connectivity Services (BCS) is able to index your external CRM data using what is called an External Content Type (ECT).

Before proceeding, I recommend you going through my previous posts, Search Your Microsoft Dynamics CRM 2011 Data with Business Connectivity Services in SharePoint 2010 Search, Associating Related Entities within Microsoft Dynamics CRM 2011 Software Using Business Connectivity Services in SharePoint 2010 Search, and Add Property Restrictions in Microsoft SharePoint 2010 Advanced Search. This article will be building upon the examples discussed previously.

In my previous blog posts, I showed you how to create a Microsoft SharePoint 2010 Search web site to find all your accounts in your Microsoft Dynamics CRM 2011 database. We covered how to associate related entities in Microsoft Dynamics CRM 2011. From searching the accounts in the database, we were able to see all associated contacts to each account. We also discovered how to further define searches and narrow them down to find specifically what we are looking for using the Advanced Search.

Now we are going to restrict existing searches using the refiners on the left side of the window. From here, we will also be able to see the number of results that match each refiner.

Before we begin, I again want to emphasize the importance of taking complete backups before doing anything in your environment.

Step 1: Create a Microsoft SharePoint 2010 Search Refinement XML File

This step will get you the XML code that you will need to edit any of the refinement changes you make to the Microsoft SharePoint Search site. This is for refining your search results.

1. In Internet Explorer, navigate to the search page from the CRM Search site previously created.
2. Type Staffing Software in the Search Box.
3. On the Site Actions drop down, select Edit Page.
4. Select the Refinement Panel on the left side of the screen.
5. Under the Options tab in the ribbon, click on Web Part Properties.
6. You should see an Advanced Search Box navigation pane appear on the right. Expand the Refinement tab.

 

staffing software

7. Click inside the Filter Category Definition field and click on the button to the right of it and a Text Editor window will popup.
8. Select all the text and Copy it.
9. Click Cancel.
10. Start Notepad.
11. Paste all of the text inside of Notepad.
12. Under File, click Save As.
13. Navigate to a location you would like to save this file.
14. For File name, name it Refinement.xml.
15. In the Save as type drop down, select All Files.
16. Click Save.
17. Close out of Notepad.
18. Make a copy of this file and save it somewhere safe. This will be your backup of the original xml code.

Step 2: Editing Refinement XML in Microsoft SharePoint Designer

This step will show you how to edit the Refinement XML for your Microsoft SharePoint Search site. From your search results, you will be able to further refine them to only display the Account.

1. Open Microsoft SharePoint Designer.
2, Right click on the Refinement.xml file you created and select Edit with Microsoft SharePoint Designer.
3. Under the Edit tab in the ribbon, click on XML to make the code more organized.
4. In the XML, search for the following line of code:

<Category    Title=”Site”    Description=”Which site this document is from”    Type=”Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator”    MetadataThreshold=”5″    NumberOfFiltersToDisplay=”4″    MaxNumberOfFilters=”20″    SortBy=”Frequency”    SortByForMoreFilters=”Name”    SortDirection=”Descending”    SortDirectionForMoreFilters=”Ascending”    ShowMoreLink=”True”    MappedProperty=”SiteName”    MoreLinkText=”show more”    LessLinkText=”show fewer” />

5. Paste the following lines of code in the XML before the above line of code:

<Category    Title=”Account”    Description=”Account”    Type=”Microsoft.Office.Server.Search.WebControls.ManagedPropertyFilterGenerator”    MetadataThreshold=”5″    NumberOfFiltersToDisplay=”4″    MaxNumberOfFilters=”20″    SortBy=”Frequency”    SortByForMoreFilters=”Name”    SortDirection=”Descending”    SortDirectionForMoreFilters=”Ascending”    ShowMoreLink=”True”    MappedProperty=”AccountEntityType”    MoreLinkText=”show more”    LessLinkText=”show fewer” ShowCounts=”Count”/>

Note: We created the Managed Property, AccountEntityType, in the previous blog post, Add Property Restrictions in Microsoft SharePoint 2010 Advanced Search. Notice that ShowCounts=”Count” was added to the XML. This makes it so the refiners on the left show how many results match the criteria. Also, this code can be inserted elsewhere in the XML. It just depends on what order you want the refiners to be displayed.

6. Click Save.
7. Open the updated Refinement.xml file in Notepad.
8. Select and copy all text.
9. In Internet Explorer, navigate to the search page from the CRM Search site previously created.
10. Type Staffing Software in the Search Box.
11. On the Site Actions drop down, select Edit Page.
12. Select the Refinement Panel on the left side of the screen.
13. Under the Options tab in the ribbon, click on Web Part Properties.
14. You should see an Advanced Search Box navigation pane appear on the right. Expand the Refinement tab.
15. Click inside the Filter Category Definition field and click on the button to the right of it and a Text Editor window will popup.
16. Select all the text and delete it.
17. Paste in the newly copied text.
18. Click Apply and then OK.
19. Click Stop Editing.
20. You will now want to run a Full Crawl (covered in previous blog post, Search Your Microsoft Dynamics CRM 2011 Software with Business Connectivity Services in SharePoint 2010 Search).
21. Perform another search to use your newly created refiner.

In the above example, I showed you how to create a new refiner based on the Microsoft CRM 2011 Account entity. You can add and remove as many custom refiners as you see fit based on whatever external data you choose. You can also add the Count feature we covered for any refiner created or already existing.

If you do not see your refiners being displayed on the left of your search window, it may be because they are not applicable. There is a Meta threshold and if there are not enough results to meet it, the refiner will not be displayed. This threshold can be adjusted in the XML.

For the next part of this blog series, we will cover how to rate your search results. This will allow for your users to see how useful others have found the results and allow for the highly rated results to appear at the top of the search.

Subscribe to our blog to receive future posts directly to your inbox.

subscribe-to-our-blog

 

Write A Comment