CRM 2011 updated Rollup 13 - Failed to execute SetStateRequest for activity entity

CRM 2011 updated Rollup 13 - Failed to execute SetStateRequest for activity entity

This question has suggested answer(s)

After Rollup 13 deployment, plugin failed to execute SetStateRequest method for activity type custom entity.

 

Basically, we have a custom entity which is activity type. A plugin is triggered at Create/Post operation of the activity entity. In this plugin, verify a business rule and proceed on some jobs. After that, change the status as Complete by SetStateRequest method.

Up to Rollup 12, we could apply this function properly. But it throws following exception after we upgraded to Rollup 13.

So, we'd like to know if anyone encountering the same problem. We'd like to hear your suggestion.

Thanks in advance.

------------------------------

Exception Detail

------------------------------

Message: An unexpected error occurred.

Source: Microsoft.Crm.Sandbox.WorkerProcess

StackTrace: Server stack trace:    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:    at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [1]:    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)    at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)    at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)    at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.Execute(OrganizationRequest request)    at SMSIntegrationPlugin.Utilities.UpdateStatus(Guid id, Int32 statusReason, Int32 stateCode, IOrganizationService svc)

All Replies
  • Hi,

    You really need to find the stack trace of the actual error - this one is just the sandbox process reporting an unexpected error. Turn on platform tracing and look in all the log files for more information - crmdiagtool2011.codeplex.com

    hth

    Scott Durow

    Read my Blog   |  Follow Me on Twitter  |  Rockstar365

  • Hi,

    Did you find the problem? It would be great if you could share what it was.

    Cheers!

    Scott Durow

    Read my Blog   |  Follow Me on Twitter  |  Rockstar365

  • Hi,

    Does issue still persist?

    If yes, can you collect Platform traces for the issue and post error stack here so that we can try to find out resolution for the issue.

    Regards,

    Satish T

    Regards,

    Satish Tiwari

    Support Engineer

    Microsoft Dynamics CRM

  • Thank you all for your kind ad vices.

    So sorry for very late reply.

    Yes, the problem still persist.

    Currently, I'm using "Async" option as workaround solution.

    I used CRMDiagTool and collected some trace logs.

    Following error message was thrown while debbuging the plugin from visual studio.

    ((System.ServiceModel.FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)(ex)).Detail.InnerServiceFault
    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index

    Please check Plugin function below. Actually, it's a simple function.

    SetStateRequest req = new SetStateRequest();
    req.EntityMoniker = new EntityReference("new_customactivity", targetId);
    if (IsValid())
    {
    req.State = new OptionSetValue(1);//Complete
    req.Status = new OptionSetValue(2);//Complete
    }
    else
    {
    req.State = new OptionSetValue(2);//Cancel
    req.Status = new OptionSetValue(3);//Cancel
    }

    SetStateResponse res = (SetStateResponse)service.Execute(req);