locked
Unable to delete few contacts from CRM 2011 RRS feed

  • Question

  • Hi All,

    When i try to delete a contact manually getting below error in trace logs. Inner ExceptionSystem.InvalidCastException: Specified cast is not valid.

    I didnt find any link that is referiing to this error.

    If anyone knows how to resolve this issue,Please let me know.

    [2014-01-28 08:58:07.035] Process: w3wp |Organization:457b2390-e086-485f-9b05-094f6410abef |Thread:   40 |Category: Platform.Sdk |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 822d2b79-7d40-41d3-a2a3-7ef45ba639af | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {7CCABB1B-EA3E-DB11-86A7-000A3A5473E8}; EntityName: contact; Stage: 30; MessageName: Delete; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: System.InvalidCastException: Specified cast is not valid.
       at Microsoft.Crm.BusinessEntities.SecurityAttributes..ctor(SecurityTraits traits, Guid objectId, Boolean allowNonUniqueRows, 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.BusinessProcessObject.PreUpdateEventHandler.Invoke(Object sender, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.UpdateWithPipelineAndExtensions(IBusinessEntity entity, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteBulkOM(CascadeRecordSet collection, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Delete(BusinessEntityMoniker moniker, ExecutionContext context)

    Thanks,
    Swathi

    Tuesday, January 28, 2014 10:00 AM

Answers

  • Do you have any reference to your contact in another entity(Cases,...,etc)?

    If so try do delete the reference first and then retry to delete the contact

    • Proposed as answer by tiagolvsantos Tuesday, January 28, 2014 10:08 AM
    • Unproposed as answer by tiagolvsantos Tuesday, January 28, 2014 10:08 AM
    • Marked as answer by Swathichandra50 Friday, March 28, 2014 9:09 AM
    Tuesday, January 28, 2014 10:08 AM

All replies

  • Do you have any reference to your contact in another entity(Cases,...,etc)?

    If so try do delete the reference first and then retry to delete the contact

    • Proposed as answer by tiagolvsantos Tuesday, January 28, 2014 10:08 AM
    • Unproposed as answer by tiagolvsantos Tuesday, January 28, 2014 10:08 AM
    • Marked as answer by Swathichandra50 Friday, March 28, 2014 9:09 AM
    Tuesday, January 28, 2014 10:08 AM
  • Hi tiagolvsantos,

    Thanks for your reply.

    I have found one custom entity record attached to the contact but getting same error mentioned above while trying to delete that record.

    While opening that custom entity record attached to the contact( i am trying to delete) getting below error

    [2014-01-28 12:58:11.015] Process: w3wp |Organization:457b2390-e086-485f-9b05-094f6410abef |Thread:   32 |Category: Platform.Sdk |User: 78e01704-1c39-4471-af2c-a67a3b22b818 |Level: Error |ReqId: f94ca312-9286-4a97-b660-6319ed190887 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {43C844B8-866F-E211-8089-005056900FFB}; EntityName: ce_externalsystem; Stage: 30; MessageName: Retrieve; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.Crm.BusinessEntities.SecurityAttributes..ctor(SecurityTraits traits, BusinessEntity entity)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PostRetrieveHandler(ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.SecurityExtension.PostRetrieveHandler(Object sender, ExtensionEventArgs e)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode, DatabaseQueryTarget queryTarget)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
    .

    Please let me know your thoughts on this.

    Thanks,
    Swathi

    Tuesday, January 28, 2014 12:00 PM