Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Email form INSERT SIGNATURE doesn't work for some users

Posted on by 213

So few months ago some users started complaining that when composing Email Activity and pressing INSERT SIGNATURE, white page opens and never finishes loading. We are using classic UI interface Dynamics 365 on premises v9.0.24.8

The cause is that CRM tries to violate unique index constraint when inserting UserEntityUISettings. It has a field InsertIntoEmailMRUXml - seems to lists last used signatures. The weird thing is for some user it works, for some it doesn't.

  • Doesn't seem to be related to permissions as two users in same business unit and same role have different outcoume - for one it works, for other - not. I'v checked anyway that there are permissions for UserEntityUISettings
  • Other thought related to permissions was - maybe user cannot read his own record and thus thinks there is no record so tries to create... anyway, I impersonated particular user within database and would be able to successfully query FilteredUserEntityUISettings view.
  • Removed that row to see if it would succeed. Yes, it succeeded for first time (Row created) - second time when using INSERT SIGNATURE - it fails, because of unique index violation. I did this only after verifying in test environment that nosthing blows up and after searching API documentation and nowhere finding a way to interface with userentityuisettings entity.

Has anyone experienced this? In the meantime I'm trying to find workaround. Either I or my users will give up ([ObjectTypeCode], [InsertIntoEmailMRUXml], [OwnerId], [OwnerIdType], [ShowInAddressBook], [UserEntityUISettingsId], [OwningBusinessUnit]) values (@ObjectTypeCode0, @InsertIntoEmailMRUXml0, @OwnerId0, @OwnerIdType0, @ShowInAddressBook0, @UserEntityUISettingsId0, @OwningBusinessUnit0) Exception: System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.UserEntityUISettingsBase' with unique index 'cndx_userentityuisettingsownerid'. The duplicate key value is (, 9997).

	at MruEntityList.Save()  ilOffset = 0x57
	at EmailSignatureService.GetInstantiatedEmailSignature(Guid signatureId)  ilOffset = 0x16

cndx_userentityuisettingsownerid ensures uniquality by OwnerId, ObjectTypeCode.

Full stack:

[2021-05-24 11:14:10.957] Process: w3wp |Organization: |Thread:   34 |Category: Platform.Sql |User:  |Level: Error |ReqId: aa7ada4a-6714-481e-b5d3-20f83992b942 |ActivityId: aa7ada4a-6714-481e-b5d3-20f83992b942 | <>c__DisplayClass2_0.b__0  ilOffset = 0x68
>Exception when executing non-query: insert into [UserEntityUISettingsBase]([ObjectTypeCode], [InsertIntoEmailMRUXml], [OwnerId], [OwnerIdType], [ShowInAddressBook], [UserEntityUISettingsId], [OwningBusinessUnit]) values (@ObjectTypeCode0, @InsertIntoEmailMRUXml0, @OwnerId0, @OwnerIdType0, @ShowInAddressBook0, @UserEntityUISettingsId0, @OwningBusinessUnit0) Exception: System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.UserEntityUISettingsBase' with unique index 'cndx_userentityuisettingsownerid'. The duplicate key value is (454d739d-127f-e511-80d3-00155def9522, 9997).
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__DisplayClass107_0.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.b__0()
ClientConnectionId:3052d487-75fd-474e-a54f-6b40d76cabca
Error Number:2601,State:1,Class:14
[2021-05-24 11:14:10.957] Process: w3wp |Organization: |Thread:   34 |Category: Exception |User:  |Level: Error |ReqId: aa7ada4a-6714-481e-b5d3-20f83992b942 |ActivityId: aa7ada4a-6714-481e-b5d3-20f83992b942 | EntityCrudManager.ThrowDuplicateRecordException  ilOffset = 0x8C
	at EntityCrudManager.ThrowDuplicateRecordException(IBusinessEntity entity, ExecutionContext context, SqlException e)  ilOffset = 0x8C
	at <>c__DisplayClass3_0.b__0()  ilOffset = 0x5E
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)  ilOffset = 0x49
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)  ilOffset = 0x12
	at BusinessProcessObject.DoCreate(IBusinessEntity entity, ExecutionContext context)  ilOffset = 0x244
	at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
	at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x3F
	at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x43
	at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x0
	at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x7
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x83
	at <>c__DisplayClass2_1.b__0()  ilOffset = 0x84
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)  ilOffset = 0x49
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)  ilOffset = 0x12
	at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x127
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x32
	at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x237
	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0x104
	at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
	at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xAF
	at <>c__DisplayClass162_0.b__0()  ilOffset = 0x9B
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)  ilOffset = 0x43
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)  ilOffset = 0x0
	at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
	at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x3F
	at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x43
	at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x0
	at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x7
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x83
	at <>c__DisplayClass2_1.b__0()  ilOffset = 0x84
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)  ilOffset = 0x49
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)  ilOffset = 0x12
	at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x127
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x32
	at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x237
	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0x104
	at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, Guid callerRegardingObjectId, Int32 invocationSource, Version endpointVersion, OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)  ilOffset = 0x33D
	at OrganizationSdkServiceInternal.DispatchRequest(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest, SdkResponseDescription responseDescription, SdkPerformanceCounterContext sdkPerformanceCounterContext)  ilOffset = 0x6
	at OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)  ilOffset = 0xCD
	at <>c__DisplayClass17_0.b__0()  ilOffset = 0xAA
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)  ilOffset = 0x43
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)  ilOffset = 0x0
	at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)  ilOffset = 0x11E
	at OrganizationSdkServiceInternal.ExecuteRequestInternal(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x7F
	at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x60
	at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x1B
	at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x20
	at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xB5
	at CreateCommand.Execute()  ilOffset = 0x6
	at MruEntityList.Save()  ilOffset = 0x57
	at EmailSignatureService.GetInstantiatedEmailSignature(Guid signatureId)  ilOffset = 0x16
	at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
	at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x3F
	at WebServiceHandler.Invoke()  ilOffset = 0xAE
	at WebServiceHandler.CoreProcessRequest()  ilOffset = 0x134
	at SyncSessionlessHandler.ProcessRequest(HttpContext context)  ilOffset = 0x3F
	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
	at HttpApplication.ExecuteStepImpl(IExecutionStep step)  ilOffset = 0x64
	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
	at PipelineStepManager.ResumeSteps(Exception error)  ilOffset = 0x27A
	at HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)  ilOffset = 0x31
	at HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)  ilOffset = 0xB0
	at PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x131
	at PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x0
	at UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  ilOffset = 0xFFFFFFFF
	at UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  ilOffset = 0xFFFFFFFF
	at PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x1E7
	at PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x0
>Crm Exception: Message: Cannot insert duplicate key., ErrorCode: -2147220937
[2021-05-24 11:14:10.957] Process: w3wp |Organization: |Thread:   34 |Category: Platform.Sdk |User:  |Level: Error |ReqId: aa7ada4a-6714-481e-b5d3-20f83992b942 |ActivityId: aa7ada4a-6714-481e-b5d3-20f83992b942 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x7
>Web Service Plug-in failed in SdkMessageProcessingStepId: {5DE0FBCA-48BF-49A4-BFD3-D23A969E0610}; EntityName: userentityuisettings; Stage: 30; MessageName: Create; 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, Siīusergnature 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__DisplayClass3_0.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.DoCreate(IBusinessEntity entity, ExecutionContext context)
.
[2021-05-24 11:14:10.957] Process: w3wp |Organization: |Thread:   34 |Category: Exception |User:  |Level: Error |ReqId: aa7ada4a-6714-481e-b5d3-20f83992b942 |ActivityId: aa7ada4a-6714-481e-b5d3-20f83992b942 | CrmDuplicateRecordException..ctor  ilOffset = 0x9
	at CrmDuplicateRecordException..ctor(String message, Exception innerException, Int32 errorCode)  ilOffset = 0x9
	at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0xF4
	at RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)  ilOffset = 0x1C8
	at Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)  ilOffset = 0xAF
	at Activator.CreateInstance(Type type, Object[] args)  ilOffset = 0x0
	at VersionedPluginProxyStepBase.WrapExceptionToThrow(CrmException exception, PipelineExecutionContext context)  ilOffset = 0x56
	at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x7
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x83
	at <>c__DisplayClass2_1.b__0()  ilOffset = 0x84
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)  ilOffset = 0x49
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)  ilOffset = 0x12
	at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x127
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x32
	at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x237
	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0x104
	at ExtensiblePlatformMessageDispatcher.Execute(PipelineExecutionContext pluginContext)  ilOffset = 0x0
	at ExtensiblePlatformMessageDispatcher.CreateWithInvocationSource(BusinessEntity entity, Int32 invocationSource, ExecutionContext context)  ilOffset = 0xAF
	at <>c__DisplayClass162_0.b__0()  ilOffset = 0x9B
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)  ilOffset = 0x43
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)  ilOffset = 0x0
	at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
	at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x3F
	at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x43
	at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x0
	at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x7
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x83
	at <>c__DisplayClass2_1.b__0()  ilOffset = 0x84
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Action action)  ilOffset = 0x49
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Action action)  ilOffset = 0x12
	at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x127
	at PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)  ilOffset = 0x32
	at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x237
	at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0x104
	at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, Guid callerRegardingObjectId, Int32 invocationSource, Version endpointVersion, OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)  ilOffset = 0x33D
	at OrganizationSdkServiceInternal.DispatchRequest(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest, SdkResponseDescription responseDescription, SdkPerformanceCounterContext sdkPerformanceCounterContext)  ilOffset = 0x6
	at OrganizationSdkServiceInternal.ExecuteRequestRequestWithInstrumentation(OrganizationRequest request, OrganizationInternalRequest organizationInternalRequest)  ilOffset = 0xCD
	at <>c__DisplayClass17_0.b__0()  ilOffset = 0xAA
	at ActivityLoggerExtensions.Execute(ILogger logger, EventId eventId, ActivityType activityType, Func`1 func)  ilOffset = 0x43
	at XrmTelemetryExtensions.Execute(ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)  ilOffset = 0x0
	at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Guid targetCallerRegardingObjectId, UserType targetUserType, OrganizationContext context, Boolean returnResponse, Boolean checkAdminMode)  ilOffset = 0x11E
	at OrganizationSdkServiceInternal.ExecuteRequestInternal(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x7F
	at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x60
	at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext)  ilOffset = 0x1B
	at InprocessServiceProxy.ExecuteCore(OrganizationRequest request)  ilOffset = 0x20
	at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xB5
	at CreateCommand.Execute()  ilOffset = 0x6
	at MruEntityList.Save()  ilOffset = 0x57
	at EmailSignatureService.GetInstantiatedEmailSignature(Guid signatureId)  ilOffset = 0x16
	at RuntimeMethodHandle.InvokeMdyethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
	at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x16
	at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x6C
	at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x3F
	at WebServiceHandler.Invoke()  ilOffset = 0xAE
	at WebServiceHandler.CoreProcessRequest()  ilOffset = 0x134
	at SyncSessionlessHandler.ProcessRequest(HttpContext context)  ilOffset = 0x3F
	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
	at HttpApplication.ExecuteStepImpl(IExecutionStep step)  ilOffset = 0x64
	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
	at PipelineStepManager.ResumeSteps(Exception error)  ilOffset = 0x27A
	at HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)  ilOffset = 0x31
	at HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)  ilOffset = 0xB0
	at PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x131
	at PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x0
	at UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  ilOffset = 0xFFFFFFFF
	at UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)  ilOffset = 0xFFFFFFFF
	at PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x1E7
	at PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)  ilOffset = 0x0
>Crm Exception: Message: Cannot insert duplicate key., ErrorCode: -2147220937, InnerException: Microsoft.Crm.BusinessEntities.CrmDuplicateRecordException: Cannot insert duplicate key.

  • Suggested answer
    JVE Profile Picture
    JVE 213 on at
    RE: Email form INSERT SIGNATURE doesn't work for some users

    So this has been resolved. For users that have this functionallity broken: Disable them and Enable. Solved.

    **Root-ish cause**

    I captured SQL Queries and for those users, before insert, I see this query:

    ---

    exec sp_executesql N'select

    top 5001 "userentityuisettings0".InsertIntoEmailMRUXml as "insertintoemailmruxml"

    , convert(bigint, "userentityuisettings0".VersionNumber) as "versionnumber"

    , "userentityuisettings0".UserEntityUISettingsId as "userentityuisettingsid"

    from

    UserEntityUISettingsBase as "userentityuisettings0"

    where

    ("userentityuisettings0".ObjectTypeCode = @ObjectTypeCode0 and "userentityuisettings0".OwnerId = @OwnerId0 and ("userentityuisettings0".OwnerId in (select pem.PrincipalId from PrincipalEntityMap pem join SystemUserPrincipals sup on pem.PrincipalId = sup.PrincipalId where sup.SystemUserId = @UserIdOwnerCommand00 and pem.ObjectTypeCode = @OtcOwnerCommand00)

    or "userentityuisettings0".UserEntityUISettingsId in (select ObjectId from fn_POARetrieveMultipleNonHierarchy(@SystemUserId0, @ObjectTypeCode1))))

    order by

    "userentityuisettings0".UserEntityUISettingsId asc',N'@ObjectTypeCode0 int,@OwnerId0 uniqueidentifier,@UserIdOwnerCommand00 uniqueidentifier,@OtcOwnerCommand00 int,@SystemUserId0 uniqueidentifier,@ObjectTypeCode1 int',@ObjectTypeCode0=9997,@OwnerId0='<masked>',@UserIdOwnerCommand00='<masked>',@OtcOwnerCommand00=2500,@SystemUserId0='<masked>',@ObjectTypeCode1=2500

    ---

    For those users 0 records are returned. Because `SystemUserPrincipals` table won't contain entry where `pem.PrincipalId` field is equals to `sup.SystemUserId`. There may be multiple records in `SystemUserPrincipals` and thus multiple `PrincipalId` values BUT one of those I suspected should have matched with SystemUserId. Because it is so for users that have this functionallity working.

    With this query I got users for whom there is no matching `SystemUserPrincipals` record:

    ---

    SELECT su.FullName, su.BusinessUnitIdName

    FROM dbo.SystemUser su

    WHERE

    su.SystemUserId NOT IN (SELECT sup.PrincipalId FROM dbo.SystemUserPrincipals sup)

    AND su.IsDisabled = 0

    ORDER BY su.BusinessUnitIdName, su.FullName

    ---

    And I really got the list with many of users who complained. So I was just guessing on how to fix this. Disabling and Re-Enabling user did the trick.

    Sorry for no-formatting - "Use rich formatting" button just opens an empty page for me and I couldn't use it.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans