Microsfoft CRM Error. Can not assign CRM accounts records from one user to another. Exception has been thrown by the target of an invocation.

Yesterday I spent a day at a client site working on various requests and issues. The main issue that took the majority of my time was an issue with their Microsoft CRM 4.0 where some account records are not being re-assigned to a different user. Everytime someone tries to re-assign these accounts, a blank error comes up saying: “Microsoft CRM Error. Contact your administrator”.

The first step was to look at the event log. Go to start -> Administrative Tools –> Event Viewer –> Application and look for the error.

I have also used the Microsoft CRM 4 Diag Tool: http://blogs.msdn.com/benlec/archive/2008/03/04/crmdiagtool4-for-microsoft-crm-4-0-has-been-released.aspx.

This is an excellent tool that you can use to enable and disable Platform trace as well as setting devErrors = true in the web.config.

The error with the stack trace came from both event log and the platform trace as follows:

——————————

 Process: w3wp |Organization:46b0a81a-db81-4bad-b1ec-6f66e1665304 |Thread:   10 |Category: Exception |User: 3df95ede-9d6f-4991-8688-32ef375f3b71 |Level: Error | CrmException..ctor
 at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException, Boolean enableTrace)
 at CrmException..ctor(String message, Int32 errorCode)
 at QueueServiceInternal`1.GetUserQueueWithObject(BusinessEntityMoniker moniker, Guid userId, ExecutionContext context)
 at QueueItemService.RouteToUser(BusinessEntityMoniker objectMoniker, Guid userIdOfCurrentObjectOwner, Guid primaryUserIdOfQueueToRouteTo, ExecutionContext context)
 at GenericActivityServiceBase.InternalAssign(BusinessEntity entity, SecurityPrincipal assignee, ExecutionContext context)
 at CascadeEngine.AssignDB(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)
 at BusinessProcessObject.Assign(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)
 at RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
 at RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
 at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
 at LogicalMethodInfo.Invoke(Object target, Object[] values)
 at InternalOperationPlugin.Execute(IPluginExecutionContext context)
 at PluginStep.Execute(PipelineExecutionContext context)
 at Pipeline.Execute(PipelineExecutionContext context)
 at MessageProcessor.Execute(PipelineExecutionContext context)
 at InternalMessageDispatcher.Execute(PipelineExecutionContext context)
 at ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
 at RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
 at RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
 at CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
 at InProcessCrmService.Execute(Object request)
 at PlatformCommand.ExecuteInternal()
 at DataSource.Assign(Guid entityId, String entityType, SecurityPrincipal principal)
 at AssignRouteOnCreateUpdateListener.AssignEntity(Entity entity, LookupValue owner)
 at AssignRouteOnCreateUpdateListener.AssignRouteEntity(Entity entity, LookupValue owner)
 at AssignRouteOnCreateUpdateListener.HandlePostEvent(PlatformCommand command, Response response, Boolean wasForUpdate)
 at CommunicationListener.HandlePostEvent(PlatformCommand command, Response response)
 at PlatformCommand.ExecuteInternal()
 at UpdateCommand.Execute()
 at EntityProxy.Update(Boolean performDuplicateCheck)
 at EntityProxy.Update()
 at AppForm.HandleFormEventAssign(Boolean gridRefreshCallbackAdded)
 at AppForm.RaiseDataEvent(FormEventId eventId)
 at EndUserForm.Initialize(Entity entity)
 at CustomizableForm.Execute(Entity entity, String formType)
 at CustomizableForm.Execute(Entity entity)
 at AccountDetailPage.ConfigureForm()
 at AppUIPage.OnPreRender(EventArgs e)
 at Control.PreRenderRecursiveInternal()
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at Page.ProcessRequest()
 at Page.ProcessRequestWithNoAssert(HttpContext context)
 at Page.ProcessRequest(HttpContext context)
 at companyname_sfa_accts_edit_aspx.ProcessRequest(HttpContext context)
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 at ApplicationStepManager.ResumeSteps(Exception error)
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
 at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>Crm Exception: Message: No user queue with the given object was found, ErrorCode: -2147220969

>MessageProcessor fail to process message ‘Assign’ for ‘account’.
[2009-06-24 10:20:02.8] Process: w3wp |Organization:46b0a81a-db81-4bad-b1ec-6f66e1665304 |Thread:   10 |Category: Platform.Sdk |User: 3df95ede-9d6f-4991-8688-32ef375f3b71 |Level: Error | InProcessCrmService.Execute
 at InProcessCrmService.Execute(Object request)
 at PlatformCommand.ExecuteInternal()
 at DataSource.Assign(Guid entityId, String entityType, SecurityPrincipal principal)
 at AssignRouteOnCreateUpdateListener.AssignEntity(Entity entity, LookupValue owner)
 at AssignRouteOnCreateUpdateListener.AssignRouteEntity(Entity entity, LookupValue owner)
 at AssignRouteOnCreateUpdateListener.HandlePostEvent(PlatformCommand command, Response response, Boolean wasForUpdate)
 at CommunicationListener.HandlePostEvent(PlatformCommand command, Response response)
 at PlatformCommand.ExecuteInternal()
 at UpdateCommand.Execute()
 at EntityProxy.Update(Boolean performDuplicateCheck)
 at EntityProxy.Update()
 at AppForm.HandleFormEventAssign(Boolean gridRefreshCallbackAdded)
 at AppForm.RaiseDataEvent(FormEventId eventId)
 at EndUserForm.Initialize(Entity entity)
 at CustomizableForm.Execute(Entity entity, String formType)
 at CustomizableForm.Execute(Entity entity)
 at AccountDetailPage.ConfigureForm()
 at AppUIPage.OnPreRender(EventArgs e)
 at Control.PreRenderRecursiveInternal()
 at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 at Page.ProcessRequest()
 at Page.ProcessRequestWithNoAssert(HttpContext context)
 at Page.ProcessRequest(HttpContext context)
 at companyname_sfa_accts_edit_aspx.ProcessRequest(HttpContext context)
 at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 at ApplicationStepManager.ResumeSteps(Exception error)
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
 at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>non-plugin non- CrmException detected – report will be sent to Watson:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.InvalidCastException: Specified cast is not valid.
   at Microsoft.Crm.BusinessEntities.SecurityAttributes..ctor(SecurityTraits traits, Guid objectId, ArrayList attributes, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.CreateSecurityAttributesForUpdateDelete(Object sender, SecurityTraits traits, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.PreUpdateHandler(ExtensionEventArgs e, Object sender)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.PreUpdateHandler(Object sender, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PreUpdateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Update(IBusinessEntity entity, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.Move(BusinessEntityMoniker objectMoniker, Guid sourceQueueId, Guid destinationQueueId, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.Route(BusinessEntityMoniker objectMoniker, Guid sourceQueueId, RouteType routeType, Guid endPointId, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.RouteToUser(BusinessEntityMoniker objectMoniker, Guid userIdOfCurrentObjectOwner, Guid primaryUserIdOfQueueToRouteTo, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.GenericActivityServiceBase.InternalAssign(BusinessEntity entity, SecurityPrincipal assignee, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.AssignDB(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Assign(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)
   — End of inner exception stack trace —
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle 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.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IPluginExecutionContext context)
   at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
[2009-06-24 10:20:02.9] Process: w3wp |Organization:46b0a81a-db81-4bad-b1ec-6f66e1665304 |Thread:   10 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ErrorInformation.LogError
 at ErrorInformation.LogError()
 at ErrorInformation..ctor(Exception exception, Uri requestUrl, Boolean logError)
 at ErrorInformation..ctor(Exception exception, Uri requestUrl)
 at MainApplication.Application_Error(Object sender, EventArgs eventArguments)
 at EventHandler.Invoke(Object sender, EventArgs e)
 at HttpApplication.RaiseOnError()
 at HttpApplication.RecordError(Exception error)
 at ApplicationStepManager.ResumeSteps(Exception error)
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
 at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>MSCRM Error Report:
——————————————————————————————————–
Error: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.

Error Message: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Error Details: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.

Source File: Not available

Line Number: Not available

Request URL: http://servername/companyname/sfa/accts/edit.aspx?id={D8365983-611F-4682-8056-80961EB6F2EF}

Stack Trace Info: [InvalidCastException: Specified cast is not valid.]
   at Microsoft.Crm.BusinessEntities.SecurityAttributes..ctor(SecurityTraits traits, Guid objectId, ArrayList attributes, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.CreateSecurityAttributesForUpdateDelete(Object sender, SecurityTraits traits, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.PreUpdateHandler(ExtensionEventArgs e, Object sender)
   at Microsoft.Crm.BusinessEntities.SecurityExtension.PreUpdateHandler(Object sender, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PreUpdateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Update(IBusinessEntity entity, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.Move(BusinessEntityMoniker objectMoniker, Guid sourceQueueId, Guid destinationQueueId, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.Route(BusinessEntityMoniker objectMoniker, Guid sourceQueueId, RouteType routeType, Guid endPointId, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.QueueItemService.RouteToUser(BusinessEntityMoniker objectMoniker, Guid userIdOfCurrentObjectOwner, Guid primaryUserIdOfQueueToRouteTo, ExecutionContext context)
   at Microsoft.Crm.ObjectModel.GenericActivityServiceBase.InternalAssign(BusinessEntity entity, SecurityPrincipal assignee, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.AssignDB(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Assign(BusinessEntityMoniker moniker, SecurityPrincipal assignee, ExecutionContext context)

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle 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.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IPluginExecutionContext context)
   at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
   at Microsoft.Crm.Application.Platform.DataSource.Assign(Guid entityId, String entityType, SecurityPrincipal principal)
   at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.AssignEntity(Entity entity, LookupValue owner)
   at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.AssignRouteEntity(Entity entity, LookupValue owner)
   at Microsoft.Crm.Application.Platform.CommunicationListeners.AssignRouteOnCreateUpdateListener.HandlePostEvent(PlatformCommand command, Response response, Boolean wasForUpdate)
   at Microsoft.Crm.Application.Platform.CommunicationListeners.CommunicationListener.HandlePostEvent(PlatformCommand command, Response response)
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.UpdateCommand.Execute()
   at Microsoft.Crm.Application.Platform.EntityProxy.Update(Boolean performDuplicateCheck)
   at Microsoft.Crm.Application.Platform.EntityProxy.Update()
   at Microsoft.Crm.Application.Forms.AppForm.HandleFormEventAssign(Boolean gridRefreshCallbackAdded)
   at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
   at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
   at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, String formType)
   at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity)
   at Microsoft.Crm.Web.SFA.AccountDetailPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

[HttpUnhandledException: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.]
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.companyname_sfa_accts_edit_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
[2009-06-24 10:20:28.0] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:    4 |Category: Platform.Sdk |User: 00000000-0000-0000-0000-000000000000 |Level: Error | SoapHeaderAuthenticationProviderBase.Authenticate
 at SoapHeaderAuthenticationProviderBase.Authenticate(HttpApplication application)
 at AuthenticationStep.Authenticate(HttpApplication application)
 at AuthenticationPipeline.Authenticate(HttpApplication application)
 at AuthenticationEngine.Execute(Object sender, EventArgs e)
 at SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 at ApplicationStepManager.ResumeSteps(Exception error)
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
 at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>CrmAuthenticationToken is missing.
[2009-06-24 10:20:28.2] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   10 |Category: Platform.Sdk |User: 00000000-0000-0000-0000-000000000000 |Level: Error | SoapHeaderAuthenticationProviderBase.Authenticate
 at SoapHeaderAuthenticationProviderBase.Authenticate(HttpApplication application)
 at AuthenticationStep.Authenticate(HttpApplication application)
 at AuthenticationPipeline.Authenticate(HttpApplication application)
 at AuthenticationEngine.Execute(Object sender, EventArgs e)
 at SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
 at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
 at ApplicationStepManager.ResumeSteps(Exception error)
 at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
 at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
 at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
 at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>CrmAuthenticationToken is missing.

——————————

After spending sometime looking at the records, running some queries on these records in Microsoft SQL Server, I decided to create a list of :

1- All userh s who have created or own these “corrupted” accounts.

2- All users who have created or own any contact, activity, opportunities or any other records that are related or associated with these CRM accounts such as primary contact, activities and history, etc..

This provided me with a list of users and on going through these users on Active directory, I found out that some of these users are not valid active directory users. They have been simply deleted from AD but left on CRM. Some users have been disabled on CRM.

This is a common issue that I have seen with many clients where they delete a user from Active directory but leave its records un-assigned to a different user.

 

Now to solve this problem, we needed to do one of the following:

1- Create the deleted user again in Activie Directory and then re-associate their CRM accounts with the new windows login you assigned to the new AD user. Once the new user is created and logged on CRM, you can go and re-assign their records to the required user. Once all records are re-assinged, then you should be able to disable the user in CRM and AD.

2- Delete the records that are associated with the deleted users (if you can’t re-assign them) and then you should be able to re-assign the account records with no problem. In this case, there will be no records associated with the deleted user, so no error should arrise.

If the account records are completely corrupted then you shoud do the following:

re-assing all activies, contacts, opportunities, etc.. which are related to these corrupted accounts to another temp account. Delete the corrupted accounts and re-create them with the same information. You can do this by exporting the data in the corrupted accounts. Delete these corrupted accounts and then import the data back in CRM as new accounts. You can also just create new accounts manually and input all their information to be similar to the corrupted accounts and then delete the corrupted ones.

One last thing, to acheive solution 1. CRM allows you to manually enter the windows login to any CRM user. You may want to create a temp Active Directory domain user to be able to change the windows login of the CRM user.

Let me know if you have any questions or require and further details. Please don’t hesitate to get in touch.

12 Replies to “Microsfoft CRM Error. Can not assign CRM accounts records from one user to another. Exception has been thrown by the target of an invocation.”

  1. Hey good stuff…keep up the good work! I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,)

    A definite great read…:)

    -Bill-Bartmann

  2. could be a couple of things.

    There is an issue where you cannot reassign some records, like accounts if the database has queueitem records that have null organizationid’s. This has been known to happen with some upgrades from 3.0.

    If you reinstall crm on your server and choose to download the latest installation files, this will fix that issue, if you have it
    Another way to fix this issue is to run the following query against your MSCRM database in SQL. Back up before you do it.

    UPDATE QueueItemBase
    SET OrganizationId = (SELECT Organizationid FROM OrganizationBase) WHERE OrganizationId IS NULL

  3. Thanks Sankel for this useful addition. It is definitely worth a try.

    Some of the records do have null organisation ID but some don’t though. I have also tried to check if the user is diabled in CRM. This, I would expect, should not cause an issue but apparently it does. Has anyone else been through this?

    One last thing, do you know, Sankel, if there is a microsoft kb talking about this specific issue?

    Thanks again.

  4. Yes. I have also had the same issue and I think having the current owner of a record disabled in CRM or Active directory does cause an issue.

  5. Hi All,

    I’m getting same error while when I was trying to assign a record to another user.
    As per given suggesstion in my QueueItemBase we don’t have any records where OrganizationId Is Null, then also I’m getting the same.

    Can anyone help me in solving the same problem since from last 2 weeks I’m working on the same error and it on my Production server.

    Thank in advance.

    Jeetu

Please comment or leave feedback