Monday, December 24, 2012

Show CRM Accounts In SharePoint List Using BCS (Business Connectivity Service)

This post describes how to show the CRM Accounts entity in SharePoint List using business connectivity service (BCS).

Keywords: SharePoint, SharePoint 2010, CRM, Integration Between SharePoint and CRM, BCS, Business Connectivity Service. External System

1. Create Domain Account
First of all, you will need to create a domain account that has access to both SharePoint and CRM system.  This account will be impersonated from SharePoint to access CRM system. Here are the steps;
1-      Log on your domain controller machine then create and account. The created one is called “bcsCRM
2-      Go to CRM system http://<CRMURL>/<OrgName>/default.aspx, go to settings, Administration, Users, then Add new User, in the User Name field write bcsCRM  then tab out, the other information will show.
3-      Save the new user, go to Security Roles section, Manage Roles,  give him a System Administration role


Top
2. Let SharePoint Impersonate this Account
This is done using SharePoint Secure Store Service. Here are the steps;
1-      Go to SharePoint Central Administration
2-      Under the Application Management Section, choose Manage Server Application.
3-      Click on Secure Store service.
4-      Click on New to create new Secure Store Target Application; then do the following
a.       In the Target Application ID write “BCSCRM_ID” or any name you would like.
b.      In the Display Name Write “BCSCRM_ID” or any name you would like.
c.       In the Contact e-mail, write youremail@domain.com.
d.      In the Target Application, select Group.
e.      Click Next.
f.        In the second screen keep everything is in default then click Next
g.       In the third screen, write how is the admins of this Target application, write spadmin and your account
h.      Specify the users/ members of this Target Application, write All Authenticated Users then click OK.

i.         You will find that your Target Application has been created with the name “BCSCRM_ID”

Top
3. Create External Content Type and External List
This section shows how to create an external Content type and external List in the top site collection site. To do this, follow the followings;
1-      Go to the top site collection site and open it using SharePoint Designer.
2-      Click on external Content Types.
3-      Click External Content Type button in the ribbon
4-      Writ the Name and the display Name of the External Content type, in our case write CRMAccounts.
5-      Click “click here to discover external data sources and define operations link”
6-      Click Add Connection Button.
7-      In the Data Source Type, Choose SQL Server.
8-      In the next dialog;
a.       In Database Server, write CRM Server Name.
b.      In the database Name, write <OrgName>_MSCRM
c.       In the connectivity Part, choose Connect with Impersonated Windows Identity.
d.      In the Secure Store Application ID, write BCSCRM_D

e.      In the windows dialog login, write bcscrm & the password.
f.        You will find the CRM in your data source explorer.
g.       Open the CRM.
h.      Choose View.
i.         Right Click on FiltredAccount, then choose Create All Operations.
j.        Choose the fields that you need to show and don’t forget to pick an identifier, the accountid is the identifier in our scenario. In this scenario, we just show Account Name and the Full Name
k.       Right on the CRMAcountss external content type and then choose Create list and forms button from the Ribbon
l.         Fill out the External List Name “Our CRM Accounts” in our scenario

m.    Go to the top site http://intranet/test/mohammed/  and you will find a list called Our CRM Acounts, has been created.


Top
4. Solving Database Respond Throttle
Sometimes the records in CRM entity exceed the DB throttle default which is 2000 records and when you open the list you see this error. “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID:4869b12c-d844-4d37-848f-c1e80a4b9639”
To solve this problem Open power shell and write the following commands
1- $bdcProxy = Get-SPServiceApplicationProxy | where{$_.GetType().FullName -eq('Microsoft.SharePoint.BusinessData.SharedService.' + 'BdcServiceApplicationProxy')}
2- $dbRule = Get-SPBusinessDataCatalogThrottleConfig -Scope Database -ThrottleType Items -ServiceApplicationProxy $bdcProxy
3- Set-SPBusinessDataCatalogThrottleConfig -Identity $dbRule -Maximum 1000000 -Default 5000

Hit the list again to see it working.





































Top

No comments:

Post a Comment