web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM 365 Merge record problem - duplicate record

(0) ShareShare
ReportReport
Posted on by 241

We just upgraded to CRM 365 on-Premise version 9. When attempting to merge two contact records I get a "Duplicate Record" error saying "A record with these values already exists. A duplicate record cannot be created. Select one or more unique values and try again."

This happened on some pairs of the records but not others. I have not found a pattern yet. It can happen to two totally unrelated records (without duplicates, active or inactive). Also we dont have any customized plugin installed on contact entity. No duplicate detect rule neither. 

Is this a bug or am I missing something.  Any help would be appreciated.

Thanks

Holly Li

*This post is locked for comments

I have the same question (0)
  • Holly Li Profile Picture
    241 on at

    Got more info from Trace:

    [2019-05-29 08:38:55.127] Process: w3wp |Organization:3a561bff-b320-46a0-bd10-761bac33a105 |Thread:   55 |Category: Platform.Sql |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00a27365-df0d-47cc-8145-fb528f639756 |ActivityId: 00a27365-df0d-47cc-8145-fb528f639756 | <>c__DisplayClass2_0.<ExecuteNonQuery>b__0  ilOffset = 0x68

    >Exception when executing non-query: update [CustomerAddressBase] set [ModifiedBy]=@ModifiedBy0, [ModifiedOn]=@ModifiedOn0, [ModifiedOnBehalfBy]=@ModifiedOnBehalfBy0, [AddressNumber]=@AddressNumber0, [ObjectTypeCode]=@ObjectTypeCode0, [ParentId]=@ParentId0, [ParentIdTypeCode]=@ParentIdTypeCode0 where ([CustomerAddressId] = @CustomerAddressId0) Exception: System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.CustomerAddressBase' with unique index 'cndx_ParentIdAddressNumber'. The duplicate key value is (9c10f255-3402-e011-bad8-00155d014601, 4).

    The statement has been terminated.

      at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)

      at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)

      at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)

      at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)

      at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)

      at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)

      at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)

      at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

      at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command)

      at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass106_0.<InternalExecuteNonQuery>b__0()

      at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)

      at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)

      at Microsoft.Crm.Platform.Server.DataEngine.SqlDataAccessManager.<>c__DisplayClass2_0.<ExecuteNonQuery>b__0()

    ClientConnectionId:fc5e324c-7b27-4203-aa01-7f2f5f29f5ea

    Error Number:2601,State:1,Class:14

    [2019-05-29 08:38:55.705] Process: w3wp |Organization:3a561bff-b320-46a0-bd10-761bac33a105 |Thread:   55 |Category: Platform.Sdk |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00a27365-df0d-47cc-8145-fb528f639756 |ActivityId: 00a27365-df0d-47cc-8145-fb528f639756 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x7

    >Web Service Plug-in failed in SdkMessageProcessingStepId: {44750CB3-CFDC-DB11-8341-0019B9204DA9}; EntityName: customeraddress; Stage: 30; MessageName: Update; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=9.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.

      at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

      at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

      at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

      at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)

      at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)

      at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)

      at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)

    Inner Exception: Microsoft.Crm.BusinessEntities.CrmDuplicateRecordException: Cannot insert duplicate key.

      at Microsoft.Crm.Platform.Server.DataEngine.EntityCrudManager.ThrowDuplicateRecordException(IBusinessEntity entity, ExecutionContext context, SqlException e)

      at Microsoft.Crm.Platform.Server.DataEngine.EntityCrudManager.<>c__DisplayClass5_0.<Update>b__0()

      at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)

      at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)

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

    .

  • Holly Li Profile Picture
    241 on at

    I think it is a CRM 365 version 9 bug. When you try to merge two contacts with more than 3 or 4 addresses you will have this problem. Remove some of the addresses from parent contacts can let you do the merge.

  • alen1979 Profile Picture
    727 on at

    Hi Holly

    We are as well on Dynamics 365V9 and are facing the same issue as you do. Have you already found a solution for this?

    Thanks

    Alen

  • Suggested answer
    Ammar Zaied Profile Picture
    1,670 on at
  • Holly Li Profile Picture
    241 on at

    Yes every time we have problem merging, we have to remove some addresses from "More Addresses". Then merge will go through. My understanding is that Address is identified by ContactId+AddressNumber. When both Child and Parent contacts have several Addresses, moving addresses from child to parent is changing addresses in child from "childContactId+AddressNumber" to "parentContactId+AddressNumber". Then violates some "unique key" restrictions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans