locked
CRM 4.0 Create Account Entity fails RRS feed

  • Question

  • In CRM 4.0, had an error reported this morning that I can't figure out.

    A bit of background, client has two systems and uses a third party tool to sync data between CRM and the other system. Had a report that the synconysation is not working.

    I investigated, saw that the data looked compelte (i.e. there were no missing fields that are required) but the transfer, on execution, was failing with a very non-descriptive error message.

    With administrator access, I went into CRM and attempted to create the new account manually (though I could get it, and then sync up the two entries afterwards). Creating a new entity from scratch also faild for me.

    I've tried to figure this out, but have no idea what is wrong. No customization or database changes have happened in this system in quite some time (I would guess that the last minor change was about 3 months ago, and the last major change was more like 6 months ago). I can confirm that adding a new account worked as recently as last week (last time a new one was added).

    Error message in CRM doesn't say much ("An error has occurred. Try this action again.......")

    Here is the stack trace:

    [2013-03-27 12:50:13.8] Process: w3wp |Organization:b2683901-6c01-4525-b63c-23180b05fc87 |Thread:    3 |Category: Platform |User: ed7ac5a2-8521-48e6-8946-ce14c7cc1f87 |Level: Error | MessageProcessor.Execute
    >MessageProcessor fail to process message 'Create' for 'account'.
    [2013-03-27 12:50:13.8] Process: w3wp |Organization:b2683901-6c01-4525-b63c-23180b05fc87 |Thread:    3 |Category: Platform.Sdk |User: ed7ac5a2-8521-48e6-8946-ce14c7cc1f87 |Level: Error | InProcessCrmService.Execute
    >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.CheckAppendAccess(BusinessEntity entity, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandlerAppendAppendToPrivilegeCheck(SecurityTraits traits, SecurityAttributes attributes, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandler(ExtensionEventArgs e, Object sender)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PreCreateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)
       at Microsoft.Crm.ObjectModel.AccountService.Create(IBusinessEntity entity, ExecutionContext context)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& 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)
    [2013-03-27 12:50:13.8] Process: w3wp |Organization:b2683901-6c01-4525-b63c-23180b05fc87 |Thread:    3 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error | ErrorInformation.LogError
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: Exception has been thrown by the target of an invocation.

    Error Message: Exception has been thrown by the target of an invocation.

    Source File: Not available

    Line Number: Not available

    Request URL: http://srvhocrm01/CRM/sfa/accts/edit.aspx

    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.CheckAppendAccess(BusinessEntity entity, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandlerAppendAppendToPrivilegeCheck(SecurityTraits traits, SecurityAttributes attributes, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PreCreateHandler(ExtensionEventArgs e, Object sender)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PreCreateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Create(IBusinessEntity entity, ExecutionContext context)
       at Microsoft.Crm.ObjectModel.AccountService.Create(IBusinessEntity entity, 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.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.ServiceCommands.CreateCommand.Execute()
       at Microsoft.Crm.Application.Platform.EntityProxy.Create(Boolean performDuplicateCheck)
       at Microsoft.Crm.Application.Platform.EntityProxy.CreateAndRetrieve(String columnSet, Boolean performDuplicateCheck)
       at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)

    Wednesday, March 27, 2013 7:13 PM

Answers

  • Hi,

    Checking the trace exception your problem is a cast, so the problem may not be related with customizations but with the data send to CRM. Can you simulating the creation passing just few fields, if works you can add the other fields one by one and check which field is giving this error.

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    Thursday, March 28, 2013 11:14 AM

All replies

  • Hi,

    Checking the trace exception your problem is a cast, so the problem may not be related with customizations but with the data send to CRM. Can you simulating the creation passing just few fields, if works you can add the other fields one by one and check which field is giving this error.

    Hope this helps.
    If i answered your question, please mark the response as an answer and also vote as helpful.


    Pedro Azevedo Crm Specialist 4.0\2011

    Thursday, March 28, 2013 11:14 AM
  • Thanks Azevedo.

    I did simulate the insert, with a limited number of fields. Got it to work okay (this narrowed down the error nicely).

    For addresses, we are using a custom entity in place of City (rather than allowing users to type city names, to avoid mis-spellings). The row that would not insert, the entity it was using for City was bad (bad row in the table). Once I fixed that row, everything worked fine.

    Thursday, March 28, 2013 4:02 PM