Showing posts with label Customisations. Show all posts
Showing posts with label Customisations. Show all posts

Monday, January 6, 2014

SQL Timeouts when Importing CRM 4.0 Customisations

Another unhelpful aspect of importing CRM 4.0 customisations is that a SQL timout can occur when importing or creating a new entity. I believe (from checking the SQL Server Profiler when this is happening) is that CRM triggers re-creation of indexes in CRM using the

exec p_RecreateIndexes

stored procedure.

On large systems this can exceed the default timeout, or even a custom timeout if you've added one. I got around this issue by running the stored procedure manually before importing the customisations to minimise the amount of re-indexing that took place.

You can also increase the timeout in CRM:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM\OLEDBTimeout

This value does not exist by default, and if it does not exist then the default value will be 30 seconds. To change it, add the registry value (of type DWORD), and put in the value you want (measured in seconds). Then you have to recycle the CrmAppPool application pool for the change to take effect

https://community.dynamics.com/product/crm/crmtechnical/b/crmdavidjennaway/archive/2008/09/04/sql-timeouts-in-crm-generic-sql-error.aspx

Missing Attribute Labels when Importing CRM 4.0 Customisations

So here I am preparing a release for our QA team to test. It's a pretty simple release, just a few entities to go into a big QA system for load testing. Imagine my surprise when 4 of the 5 entities import, and one consistently throws up unhelpful CRM errors. Here's what I can find in the Event Log on the CRM server:

"Customization Import failed. Error: Attribute Display Name not specified"

To cut a long story short - I had several attributes on my entity that were unpublished - a rookie mistake! So make sure you publish your entity before exporting it. Why this happens, I don't know - all I know at this point was that before re-publishing the entity customisations my attribute looked like this:

<attribute PhysicalName="my_attributename">
    <Type>datetime</Type>
    <ValidForCreateApi>1</ValidForCreateApi>
    <ValidForUpdateApi>1</ValidForUpdateApi>
    <ValidForReadApi>1</ValidForReadApi>
    <IsCustomField>1</IsCustomField>
    <AttributeTypeId>00000000-0000-0000-00aa-110000000015</AttributeTypeId>
    <DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid</DisplayMask>
    <ImeMode>auto</ImeMode>
    <RequiredLevel>none</RequiredLevel>
    <Format>date</Format>
</attribute>

After publishing becomes:

<attribute PhysicalName="my_attributename">
    <Type>datetime</Type>
    <ValidForCreateApi>1</ValidForCreateApi>
    <ValidForUpdateApi>1</ValidForUpdateApi>
    <ValidForReadApi>1</ValidForReadApi>
    <IsCustomField>1</IsCustomField>
    <AttributeTypeId>00000000-0000-0000-00aa-110000000015</AttributeTypeId>
    <DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid</DisplayMask>
    <Descriptions>
        <Description description="Attribute Name" languagecode="1033" />
    </Descriptions>
    <ImeMode>auto</ImeMode>
    <RequiredLevel>none</RequiredLevel>
    <Format>date</Format>
    <displaynames>
      <displayname description="Attribute Name" languagecode="1033" />
    </displaynames>
</attribute>