POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

If you recently upgraded to Microsoft Dynamics CRM 2013 from CRM 4.0 and are getting an error when attempting to activate or deactivate a contact or account record, we may have the solution for you!

troubleshooting

So what does this particular error look like? When attempting to activate or deactivate the record, you may receive a Generic SQL Error message alert box, and when you download the log file from the user interface, you may find the following output:

Deactivating Accounts or Contacts in CRM 2013

Unexpected Error. An error has occurred.”

This is a pretty standard error and doesn’t tell us much by itself. So what should you do?

1. Try running a trace on the CRM server. You may find the following error message in the stack trace, with the relevant parts are highlighted below. (NOTE: You can find steps on how to enable tracing on the CRM server here.)

[Date/Timestamp] Process: w3wp |Organization: CRMOrganizationID |Thread: TreadID |Category: Platform.Sdk |User: UserGUID |Level: Error |ReqId: GUID | VersionedPluginProxyStepBase.Execute ilOffset = 0x65

    at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) ilOffset = 0x65

    at Pipeline.Execute(PipelineExecutionContext context) ilOffset = 0x65

    at MessageProcessor.Execute(PipelineExecutionContext context) ilOffset = 0x1C5

    at InternalMessageDispatcher.Execute(PipelineExecutionContext context) ilOffset = 0xE4

    at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext) ilOffset = 0x0

    at ExtensiblePlatformMessageDispatcher.UpdateWithInvocationSource(BusinessEntity entity, FilterExpression filter, Int32 invocationSource, ExecutionContext context) ilOffset = 0xCE

    at ExtensiblePlatformMessageDispatcher.Update(BusinessEntity entity, FilterExpression filter, ExecutionContext context) ilOffset = 0x5

    at BusinessProcessObject.UpdateWithPipelineAndExtensions(IBusinessEntity entity, ExecutionContext context) ilOffset = 0x78

    at AccountService.Update(IBusinessEntity entity, ExecutionContext context) ilOffset = 0x37

    [truncated…]

>Web Service Plug-in failed in SdkMessageProcessingStepId: {32750CB3-CFDC-DB11-8341-0019B9204DA9}; EntityName: account; Stage: 30; MessageName: Update; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Inner Exception: System.InvalidCastException: Specified cast is not valid.

at Microsoft.Crm.BusinessEntities.AddressTrigger.Update(Guid id)

at Microsoft.Crm.BusinessEntities.TriggersExtension.ExecuteTriggers(BusinessEntity entity, ArrayList triggers, OperationType operationType)

at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoUpdate(IBusinessEntity entity, FilterExpression filter, ExecutionContext context)

In this case, you can see that the user is attempting to perform the action against the account entity using the out-of-the-box plugin (Microsoft.Crm.Extensibility.InternalOperationPlugin).

2. If you look at the “Inner Exception” message, you will want to pay close attention to the top line. This indicates the last thing CRM was attempting to do when the error occurred (at Microsoft.Crm.BusinessEntities.AddressTrigger.Update(Guid id)). This last method in the error message tells us that there is an issue with the addresses assigned to the account in question. This information is stored in the CustomerAddressBase table in the organization database.

3. Upon further investigation, you might that there’s a record missing from the CustomerAddressBase relating to the account record in the ParentId field in the table. By default, there should be at least two records for each ParentId entry differentiated by CusomterAddressId. This is then further differentiated by AddressNumber 1 and 2. As you might have figured out, 1 is for the Address 1 fields and 2 is for the Address 2 fields relating to the ParentId record.

4. So now to answer the question: “How do I fix this?” Well, the easiest way is to create a new record and merge the needed data over to a new record except for the address information. For the address portion, we suggest manually entering it into the new record’s address information section or the merge will not work. You can take this same process one step further to identify any further records that may be affected by this particular issue by running the following query within SQL Server Management Studio.

select Name as
‘Account Name’,
(select
count(*)
from CustomerAddressBase where ParentId = AB.AccountId)
as
‘Count’

from AccountBase AB

where (select
count(*)
from CustomerAddressBase where ParentId = AB.AccountId)
< 2

select FullName as
‘Contact Name’,
(select
count(*)
from CustomerAddressBase where ParentId = CB.ContactId)
as
‘Count’

from ContactBase CB

where (select
count(*)
from CustomerAddressBase where ParentId = CB.ContactId)
< 2

In instances where these steps do not resolve the issue, we would encourage you to reach out to our support team as there may be additional issues causing this issue.

Happy CRM’ing!

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.