Mapping Component Issues

By | February 16, 2013

Recently while installing the Standard Mapping Component in SageCRM component manager, I encountered below error.

As seen from the error message highlighted above its caused because of missing Clustered indexes on Company and Lead tables. I was a bit surprised knowing the reason of error as Indexes are by default defined on CRM database by the Sage when we install CRM. So, on further investigation I found that there was actually no Clustered index defined for Primary keys for Company and Lead entity. Though the component gets successfully installed, impact of this error will be that the loading speed of the maps will be very slow and hence irritating from user perspective. Also I found that some releases of SageCRM have in built clustered indexes on Company and Lead tables in CRM database. In this case component will get installed without any error.
The workaround for this issue is that we need to run SQL queries which will create Clustered indexes on the Company and Lead Tables. Before running these queries make sure that you have the database backup on which you are going to run the script. Below is the SQL query
/*  Script to create clustered indexes on company and lead tables */
USE [DATABASE NAME]
——Script to create clustered indexes on company——–
ALTER TABLE [dbo].[Company] ADD PRIMARY KEY CLUSTERED
(
[Comp_CompanyId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
——— Script to create clustered indexes on Lead Table——
ALTER TABLE [dbo].[Lead] ADD  CONSTRAINT [PK_Lead_Lead_LeadID] PRIMARY KEY CLUSTERED
(
[Lead_LeadID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
After the query gets executed follow the below steps:

  1. Uninstall the Mapping Component by navigating to Administration -> Customization -> Component Manager and then check the checkbox and hit the Install Button as shown in the below image.
  1. Re-run the Mapping Component.