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.

MS CRM Key Generator error – Invalid Action – Microsoft CRM 4 Error.

I have just started my Microsoft CRM 4.0 VM, tried to run a .NET console application and I got a full list of errors although the code was working fine the night before! When I tried to open Microsoft CRM 4.0, I got an error “Invalid Action” with the sentence starting with “error in command”. This failure was happening with all CRM organisations not just related to a specific one.

When I checked my event log, I found the following errror:

Event Type: Error
Event Source: MSCRMKeyGenerator
Description:
Current active key (KeyType : CrmWRPCTokenKey) is expired. This can indicate that a key is not being regenerated properly. Current Active Key : CrmKey(…, ScaleGroupId:00000000-0000-0000-0000-000000000000, KeyType:CrmWRPCTokenKey, Expired:True, ValidOn: …, ExpiresOn: …, CreatedOn: …, etc..

When I searched for a cause/solution for this issues, I found this excellent post on Nishant Rana’s blog (http://nishantrana.wordpress.com/2008/06/11/invalid-action-error-microsoft-dynamics-crm-40/).

Following the advice on this page, I searched and started the Microsoft CRM Asynchronous Processing Service on the CRM server and this has solved the problem instantly for me.

Hope this helps!