Category Archives: Error

CRM 4.0 to CRM 2011 Upgrade Issue : The given key was not present in the dictionary

While importing CRM 4.0 organization to CRM 2011 environment we were kept getting error and error log is recording error as mentioned below..


InnerException:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.AddEntityRelationshipRolesToCollections(IPreloadedMetadataInitializationContext context)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.Initialize(IOrganizationContext organizationContext, MetadataContainer container, LoadMasks masks)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.CreateMetadataCacheDataProvider(MetadataContainer container, IOrganizationContext context, LoadMasks masks, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.BuildMetadataCacheFromMetadataContainer(MetadataContainer container, LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, LoadMasks masks, IOrganizationContext context)
at Microsoft.Crm.Setup.MetadataCacheLoadHelper.LoadCacheFromDatabase(CacheType existingMetadataCacheType, LoadMasks masks, String connectionString, Guid organizationId)
at Microsoft.Crm.Setup.DiffBuilder.PopulateExistingMetadataCacheFromDatabase(CacheType existingMetadataCacheType, String connectionString)
at Microsoft.Crm.Setup.DiffBuilder.Pass0(String metadataLocation)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.Crm.Setup.Database.DllMethodAction.Execute()
at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase, Boolean isInstall)
at Microsoft.Crm.Tools.Admin.InstallDatabaseAction.Do(IDictionary parameters)
at Microsoft.Crm.Setup.Common.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
InnerException:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.AddEntityRelationshipRolesToCollections(IPreloadedMetadataInitializationContext context)
at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.Initialize(IOrganizationContext organizationContext, MetadataContainer container, LoadMasks masks)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.CreateMetadataCacheDataProvider(MetadataContainer container, IOrganizationContext context, LoadMasks masks, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.BuildMetadataCacheFromMetadataContainer(MetadataContainer container, LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabaseInternal(LoadMasks masks, CrmDbConnection connection, CrmTransaction transaction, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheLoader.LoadCacheFromDatabase(LoadMasks masks, IOrganizationContext context, CounterList counter)
at Microsoft.Crm.Metadata.DynamicMetadataCacheFactory.LoadMetadataCache(LoadMethod method, CacheType type, LoadMasks masks, IOrganizationContext context)
at Microsoft.Crm.Setup.MetadataCacheLoadHelper.LoadCacheFromDatabase(CacheType existingMetadataCacheType, LoadMasks masks, String connectionString, Guid organizationId)
at Microsoft.Crm.Setup.DiffBuilder.PopulateExistingMetadataCacheFromDatabase(CacheType existingMetadataCacheType, String connectionString)
at Microsoft.Crm.Setup.DiffBuilder.Pass0(String metadataLocation)

Solution

After investigating this issue further (and trying import multiple times) we guessed that issue is coming because CRM 4.0 organization had one of the unsupported customization applied on one of system entity relationship behaviour.

So first thing is to find out which entity relationship is causing this issue and once this is found then revert that changes in staging database (on top of fresh CRM 4.0 database before importing in to CRM 2011 as Organization).

We found this entity relationship and it is against “contact_as_responsible_contact” for this current Organization.

The way to find this out is compare your organization’s EntityRelationship table against standard out of the box CRM 4.0 EntityRelationship table.

After this we need to update problematic table records to match to system behaviour (CRM 4.0 out of box). We have run following script for the same.(please note schema name and ID would be different for your organization)

Update [MetadataSchema].[EntityRelationship]
set [IsCustomRelationship] =0,
[CustomizationLevel]=0
where SchemaName ='contact_as_responsible_contact'

Update [MetadataSchema].EntityRelationshipRelationships
set [CustomizationLevel] =0
where EntityRelationshipId ='ECE6333A-F356-42C5-BB26-B454DC0C0B33'

Update [MetadataSchema].EntityRelationshipRole
set [CustomizationLevel] =0
where EntityRelationshipId ='ECE6333A-F356-42C5-BB26-B454DC0C0B33'

Hope this helps..

Note: This is unsupported customization, Please unit test this module on your development/test environment before applying it to Live Environment…

Cheers,
MayankP:)

Advertisements

CRM 4.0 Printing Error – This form has been changed and must be saved before printing.

One of user posted this error in this CRM thread, we had similar issue some time back and one of my colleagues had resolved this issue.

Problem
This error comes if you got java script code which is constantly updating some variables in the back ground. This makes CRM Form engine believes that form has been changed so CRM print function will not allow you print CRM form.

Solution
The solution for this is that we over ride existing CRM print on click event and write function to run this print job manually.
Following is example script for Phone call entity. This script needs to put in to the Form On Load Event.

Following text version of above code, change the object type code as per your requirement.

if (document.getElementById('_MBcrmFormPrint') != null)
{
document.getElementById('_MBcrmFormPrint').action = ' openStdWin(prependOrgName("/_forms/print/print.aspx?objectType=4210&id=" + crmForm.ObjectId + "&title=" + CrmEncodeDecode.CrmUrlEncode(parent.document.title))); ';
}

Hope this helps!!

Note: – This is unsupported change so please make sure you take necessary back up before doing this change.

Cheers,
MayankP 🙂

CRM 4.0 Error “Failure: Relationshipname : Invalid Argument”

Recently while importing customization from one environment to another I started getting following exception.

“Failure: : Invalid Argument”

we also checked logged error on Event log and this import was logging following error..

“Customization Import failed. Error: Attribute Display Name not specified”

After few trial and error we were able to resolve the issue.

Resoution

There are two ways to resolve this.
1. Make sure all entities are published on source system and then extract entities again and then try putting in to destination system and see if this works…
(This method is preferred)

2. Other method is to export only entities which had issue while importing on destination. Then open Export XML and then locate relevant field name and that field name will have tag. If you update this tag with some text then that should also resolve this issue.
(see below screen print)

Hope this helps..

Cheers,
MayankP:)

CRM 4.0 Adding Marketing List Member issue

Issues description

Recently we started getting following error while adding data marketing list member.
“There is a problem communication with the Microsoft Dynamics CRM server. The server might be unavailable”.

Solution

After few trial and error found that this error is coming because some of the record owner (System users) are disabled so if you select only records owned by enabled user then this works fine…

Hope this helps…

Regards,
MayankP:)

Dynamic CRM : Troubleshooting methods for any CRM issue

While working with CRM sometimes we get following exception screen with this message, which means there is some exception or issue on this operation.

An error has occurred
Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solution or contact your organisation’s Microsoft Dynamics CRM Administrator. Finally you can contact Microsoft Support.

Following methods will help you crack down the real cause of this exception or error.

Method 1: Check the Event Log

 Log in to CRM and reproduce the error
 Go to CRM Application server -> Run – > Type eventvwr
 And check application event log and find the relevant log and this will have actual exception details regarding this problem.

Method 2: Enable Development Errors on CRM Web site

 On the Microsoft CRM Web server, navigate to \ (typically C:\Inetpub\wwwroot\ or C:\Program Files\Microsoft Dynamics CRM\CRMWeb)
 Open the Web.config file.
 Look for the DevErrors key, and change its value to On.
 Save the Web.config file.
 Login to CRM and reproduce error and you will screen which will give actual error (as shown below)

Method 3: Enable Tracing on CRM Server

 Download CRM diagnostic tool
 Run this tool on CRM Application server and enable the tracing (alternatively you can enable trace as mentioned in this kb article http://support.microsoft.com/kb/907490)
 Login to CRM and reproduce error
 Disabled the tracing
 Go to tracing folder and open log file and locate the exception related to your operation.

Of course after finding actual cause of the exception solution will really different for each exception but above troubleshooting method will help you get in to right direction to fix any dynamic CRM issue.

Hope this helps…

Regards,
MayankP 🙂

Plug-in type With Id = GUID Does Not Exist

We suddenly started getting following exception on one of our CRM environment.

Unhandled Exception: System.Web.Services.Protocols.SoapException:
Server was unable to process request. Detail:

0x80040217
plugintype With Id = 6ba57788-1975-df11-8b26-0050568d68ea Does Not Exist Platform

Cause:

The reason this error occurred on our environment is that we had plug in assembly registered on crm database as Database deployment and we then unregister the assembly and registered it again which caused problem because steps of the previous assembly was already there in the database (even though they are marked for deletion).

Resolution:

This is tricky problem and might need unsupported SQL delete of the records which are corrupted.

IMP. NOTE: This is unsupported and you should back up your SQL before doing any changes. If you got MS support then it is better to contact them for this tricky issue.

Basically you need to delete or check records regarding this plug in type and store all the rows you remove in excel file because you might need to refer it again to get the relevant Guid.
Firstly let me explain the list of table which stored plug in related details.

PluginTypeBase – all individual Plug In (classes) will be stored in this table.

PluginTypeBaseIds – This is GUID of the record from PluginTypeBase table (this table links individual class with other tables in CRM).

SdkMessageProcessingStepBase – This table stores all the steps related to particular class

SdkMessageProcessingStepBaseIds – This table stores GUID of the record from SdkMessageProcessingStepBase table.

SdkMessageProcessingStepImageBase – This tale stores image s details related to steps.

SdkMessageProcessingStepSecureConfigBase – This table stores any configuration related to this plug-In type.

Now let’s do select queries first to see all records are relevant to our plug–in type and then we need to just replace delete command with select to remove related records from database.

select * from PluginTypeBaseIds where PluginTypeId = GUID
(e.g. select * from PluginTypeBaseIds where PluginTypeId = 'FB270B8E-B48D-DF11-8D06-18A90547D5EE')

SELECT * FROM PluginTypeBase where PluginTypeId = GUID

SELECT * FROM [SdkMessageProcessingStepBase] where PluginTypeId = GUID

SELECT * FROM [SdkMessageProcessingStepBaseIds] where [SdkMessageProcessingStepId] in (Select
SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]
where PluginTypeId = GUID)

SELECT * FROM [SdkMessageProcessingStepImageBase] where [SdkMessageProcessingStepId] in (Select
SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]
(Select SdkMessageProcessingStepId FROM [SdkMessageProcessingStepBase]where PluginTypeId = GUID)

SELECT * FROM [SdkMessageProcessingStepSecureConfigBase]

Verify that above queries gives you only record related to your plug-in Type , so read the description column on each row and make sure this is related to your plug in type only, Now we need to start deleting records from bottom tables to top.

-> SdkMessageProcessingStepSecureConfigBase table first (only row related to your plug in type and if your plug in type does not have related record in this table ignore this one) and then

-> SdkMessageProcessingStepImageBase (only record related to your GUID) and then

-> SdkMessageProcessingStepBaseIds (you may need to do this after sdkMessageProcessingStepBase so store Guid
and then delete after you delete records from sdkMessageProcessingStepBase table) (only record related to your
GUID)

-> SdkMessageProcessingStepBase (only record related to your GUID)

-> PluginTypeBaseIds (only record related to your GUID)

-> PluginTypeBase (only record related to your GUID)

After all delete queries are run successfully restart CRM Service and Asynchronous Service..

Hope this helps, if need more information please put comments on this post and I will respond with more details ..

Cheers,
MayankP 🙂

CRM 4.0 SQL Time out Issue

We recently started getting problem while creating new entity or importing any new entity in one of our CRM Environment.

Following is full description of error logged on Server Event Log.

Problem

The description for Event ID 17415 from source MSCRMAsyncService cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
<>
<>
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command)
at Microsoft.Crm.CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate)
at Microsoft.Crm.Asynchronous.DataAccessBase.ExecuteSqlCommandAndProcessRecords(IDbCommand command, RecordProcessor recordProcessor)
at Microsoft.Crm.Workflow.WaitSubscriptionDataAccess.Notify(IDbCommand selectCommand, WaitNotificationService waitNotificationService)
at Microsoft.Crm.Workflow.WaitSubscriptionDataAccess.Notify(String hostId, WaitNotificationService waitNotificationService, Int32 maxRetries)
at Microsoft.Crm.Workflow.WorkflowHost.OnNotificationTimerEvent(Object sender, ElapsedEventArgs e)
the message resource is present but the message is not found in the string/message table

Cause:
There is a slow response from SQL which leads to the CRM platform timing out.

Resolution:

After carefully debugging and investigating it turns to be SQL Time out issue and the process of creating new entity is taking more than 30 seconds.
We added following registry keys to HKLM\Sofware\Microsoft\MSCRM folder and this resolved this problem.

DWORD OLEDBTimeout = 300000 (decimal)
DWORD ExtendedTimeout = 1000000 (decimal)
DWORD NormalTimeout = 1000000 (decimal)

Cheers,
MayankP:)