locked
State code or status code is invalid while deactivate the custom entity record RRS feed

All replies

  • posting the trace log here..

    # ScaleGroup:
    # ServerRole: AppServer, AsyncService, DiscoveryService, ApiServer, HelpServer, DeploymentService, SandboxServer, DeploymentManagementTools, VssWriter, EmailConnector

    [2014-03-18 04:13:32.491] Process: w3wp |Organization:d133c867-097c-e011-a247-02bf9d3bc4f8 |Thread:   62 |Category: Exception |User: 7492ef42-9460-e311-940e-002dd80b0ca0 |Level: Error |ReqId: fdb76819-9781-4299-9e45-2b6f296f4fce | CrmException..ctor  ilOffset = 0x7
     at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
     at CrmException..ctor(String message, Exception innerException, Int32 errorCode)  ilOffset = 0x5
     at StatusCodeValidator.Validate(EntityMetadata entityMetadata, Int32 stateCode, Int32 statusCode)  ilOffset = 0x54
     at BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, BusinessEntity originalEntity, ExecutionContext context)  ilOffset = 0x0
     at BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, ExecutionContext context)  ilOffset = 0x1A
     at RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)  ilOffset = 0xFFFFFFFF
     at RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)  ilOffset = 0x25
     at RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)  ilOffset = 0x89
     at LogicalMethodInfo.Invoke(Object target, Object[] values)  ilOffset = 0x4F
     at InternalOperationPlugin.Execute(IServiceProvider serviceProvider)  ilOffset = 0x57
     at V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)  ilOffset = 0x58
     at VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)  ilOffset = 0x65
     at Pipeline.Execute(PipelineExecutionContext context)  ilOffset = 0x65
     at MessageProcessor.Execute(PipelineExecutionContext context)  ilOffset = 0x1C5
     at InternalMessageDispatcher.Execute(PipelineExecutionContext context)  ilOffset = 0xE4
     at ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)  ilOffset = 0x16E
     at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)  ilOffset = 0x16A
     at OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x3D
     at OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)  ilOffset = 0x24
     at   ilOffset = 0xFFFFFFFF
     at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  ilOffset = 0x241
     at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  ilOffset = 0x100
     at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  ilOffset = 0x48
     at ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)  ilOffset = 0xC6
     at MessageRpc.Process(Boolean isOperationContextSet)  ilOffset = 0x62
     at ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)  ilOffset = 0x256
     at ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)  ilOffset = 0xF1
     at ChannelHandler.AsyncMessagePump(IAsyncResult result)  ilOffset = 0x39
     at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
     at AsyncResult.Complete(Boolean completedSynchronously)  ilOffset = 0xC2
     at AsyncQueueReader.Set(Item item)  ilOffset = 0x21
     at InputQueue`1.EnqueueAndDispatch(Item item, Boolean canDispatchOnThisThread)  ilOffset = 0xD6
     at InputQueue`1.EnqueueAndDispatch(T item, Action dequeuedCallback, Boolean canDispatchOnThisThread)  ilOffset = 0x0
     at SingletonChannelAcceptor`3.Enqueue(QueueItemType item, Action dequeuedCallback, Boolean canDispatchOnThisThread)  ilOffset = 0x3D
     at EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result)  ilOffset = 0x61
     at EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result)  ilOffset = 0x13
     at AsyncResult.AsyncCompletionWrapperCallback(IAsyncResult result)  ilOffset = 0x52
     at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
     at AsyncResult.Complete(Boolean completedSynchronously)  ilOffset = 0xC2
     at ParseMessageAsyncResult.OnRead(IAsyncResult result)  ilOffset = 0x43
     at AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  ilOffset = 0x0
     at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x70
     at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)  ilOffset = 0x4
     at ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(Task completingTask)  ilOffset = 0x45
     at Task.FinishContinuations()  ilOffset = 0x67
     at Task.Finish(Boolean bUserDelegateExecuted)  ilOffset = 0x3C
     at Task.ExecuteWithThreadLocal(Task& currentTaskSlot)  ilOffset = 0xC4
     at Task.ExecuteEntry(Boolean bPreventDoubleExecution)  ilOffset = 0x96
     at ThreadPoolWorkQueue.Dispatch()  ilOffset = 0xA2
    >Crm Exception: Message: -1 is not a valid state code on new_partner., ErrorCode: -2147187704, InnerException: System.ArgumentException: -1 is not a valid state code on new_partner.
    Parameter name: stateCode
    [2014-03-18 04:13:32.562] Process: w3wp |Organization:d133c867-097c-e011-a247-02bf9d3bc4f8 |Thread:   62 |Category: Platform.Sdk |User: 7492ef42-9460-e311-940e-002dd80b0ca0 |Level: Error |ReqId: fdb76819-9781-4299-9e45-2b6f296f4fce | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {1FE67FC9-85A6-E011-AEE1-002DD802FEB1}; EntityName: new_partner; Stage: 30; MessageName: SetStateDynamicEntity; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=6.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: Microsoft.Crm.CrmArgumentException: -1 is not a valid state code on new_partner.
       at Microsoft.Crm.BusinessEntities.StatusCodeValidator.Validate(EntityMetadata entityMetadata, Int32 stateCode, Int32 statusCode)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, BusinessEntity originalEntity, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, ExecutionContext context)
    Inner Exception: System.ArgumentException: -1 is not a valid state code on new_partner.
    Parameter name: stateCode

     --- End of inner exception stack trace ---
       at Microsoft.Crm.BusinessEntities.StatusCodeValidator.Validate(EntityMetadata entityMetadata, Int32 stateCode, Int32 statusCode)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, BusinessEntity originalEntity, ExecutionContext context)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.SetState(BusinessEntityMoniker moniker, Int32 newState, Int32 newStatusCode, ExecutionContext context)
    [2014-03-18 04:13:32.586] Process: w3wp |Organization:d133c867-097c-e011-a247-02bf9d3bc4f8 |Thread:   62 |Category: Platform |User: 7492ef42-9460-e311-940e-002dd80b0ca0 |Level: Error |ReqId: fdb76819-9781-4299-9e45-2b6f296f4fce | MessageProcessor.Execute  ilOffset = 0x1C5
    >MessageProcessor fail to process message 'SetStateDynamicEntity' for 'new_partner'.
    [2014-03-18 04:13:32.586] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   62 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: fdb76819-9781-4299-9e45-2b6f296f4fce | ExceptionConverter.ConvertToFault  ilOffset = 0x69
    >UNEXPECTED: no fault?

    Thanks,

    Arvind Singh


    Regards, Arvind


    • Edited by ArvindSingh Tuesday, March 18, 2014 12:29 PM Missed some error log
    Tuesday, March 18, 2014 12:25 PM
  • It's not complaining about your 'status' (reason) code, but your 'state' code. I don't know if it's the same but we saw a similar issue with code that disables user records. In 2011 you set state=-1 and status=-1 to disable a user, but now in 2013 you have to set state=1 and status=-1.

    So maybe you need to set your state code to not use -1 anymore.

    Compare http://msdn.microsoft.com/en-us/library/jj602914(v=crm.6).aspx and http://msdn.microsoft.com/en-us/library/jj602914(v=crm.5).aspx and note the difference. Again, not sure if deactivating your record is the same issue but it sounds similar...

    Tuesday, March 18, 2014 8:20 PM
  • Hi Ken,

    Thank you for reply.

    Are you saying that I have to write some custom code to deactivate custom entity records, Is not it OOB product functionality(Activate and Deactivate) for any custom records?? Because I have not written any code to deactivate/activate the custom entity records either in CRM 2011 or CRM 2013.Ideally it should be changed during migration only.

    Thanks,

    Arvind


    Regards, Arvind

    Wednesday, March 19, 2014 6:32 AM
  • I assumed you were deactivating it through code, not the UI. If you just cannot deactivate through the UI, yes that's a bigger problem.
    Wednesday, March 19, 2014 4:11 PM
  • No..I am not using any code to activate/deactivate, using OOB functionality.

    Thanks,
    Arvind Singh


    Regards, Arvind

    Thursday, March 20, 2014 9:38 AM
  • Arvind - I realize this thread is old, but wanted to see if you found a resolution. I am encountering the same issue on custom entities. All OOTB entities can be disabled/enabled without issue.
    Wednesday, April 29, 2015 9:17 PM
  • One thing to check is whether you have published the custom entity (or entities). I could imagine this could occur on a custom entity if it had never been published

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Thursday, April 30, 2015 10:06 AM
    Moderator
  • I encounted this as well today, but I was trying to reactivate a currently deactivated record on a custom entity.  I was able to reactivate the record by creating a Real Time On Demand workflow process with only an activate step in the process.  After refreshing, the record was activated.


    Still have not found the root cause to the error, but this helped me solve the immediate need of the customer.
    • Edited by Jeff Braeunig Friday, September 18, 2015 2:47 PM
    • Proposed as answer by Jeff Braeunig Friday, September 18, 2015 2:47 PM
    Friday, September 18, 2015 2:46 PM