Hi All,
I am encountering a strange issue with updating a money field on CRM, I am trying to update a money field on a linked entity by trying to retrieve that field, when I am doing that via plugin I get the following error
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts"> <ActivityId>48a59228-c124-420e-87b7-f04263a13c6a</ActivityId> <ErrorCode>-2147220891</ErrorCode> <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic"> <KeyValuePairOfstringanyType> <d2p1:key>OperationStatus</d2p1:key> <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:int">0</d2p1:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <d2p1:key>SubErrorCode</d2p1:key> <d2p1:value xmlns:d4p1="www.w3.org/.../XMLSchema" i:type="d4p1:int">-2146233088</d2p1:value> </KeyValuePairOfstringanyType> </ErrorDetails> <Message>Index (zero based) must be greater than or equal to zero and less than the size of the argument list.</Message> <Timestamp>2018-07-02T16:26:19.7398323Z</Timestamp> <ExceptionRetriable>false</ExceptionRetriable> <ExceptionSource>PluginExecution</ExceptionSource> <InnerFault i:nil="true" /> <OriginalException>Microsoft.Xrm.Sdk.InvalidPluginExecutionException at Hsl.Wendys.Crm.Plugins.Commitment.AwardCommitment.ExecuteAction() at Hsl.Xrm.Sdk.Plugin.PluginBase.Execute(IServiceProvider serviceProvider) at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.<>c__DisplayClass8.<Execute>b__1() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext, Boolean enablePluginStackTrace, Boolean chaosFailAppDomain) at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext, Boolean enablePluginStackTrace, Boolean chaosFailAppDomain) at Microsoft.Crm.Sandbox.SandboxWorker.Execute(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, SandboxRequestCounter& workerCounter, Boolean returnTraceInfo)</OriginalException> <TraceText> An exception has occurred in the [Hsl.Wendys.Crm.Plugins.Commitment.AwardCommitment]. An invalid operation has occurred during the execution of the plugin. {Microsoft.Xrm.Sdk.InvalidPluginExecutionException} from {Hsl.Wendys.Crm.Plugins} - Index (zero based) must be greater than or equal to zero and less than the size of the argument list. at Hsl.Wendys.Crm.Plugins.Commitment.AwardCommitment.ExecuteAction() at Hsl.Xrm.Sdk.Plugin.PluginBase.Execute(IServiceProvider serviceProvider) </TraceText> </OrganizationServiceFault> 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 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.ISandboxHost.ExecuteAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, String assemblyContents, Boolean returnTraceInfo) at Microsoft.Crm.Sandbox.SandboxPlugin.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo) at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context) |
|||
while this error occurs I see there are two scenarios output one in which the expected update occurs but still the error is thrown out and the second one only error occurs and the money field update doesn't happen, this is happening consistently and debugging the code is showing that the field I'm trying to retrieve is not available at run time to actually update the values in it
Entity budgetLine = new Entity(target.LogicalName);
//this.Context.SystemOrgService.Retrieve(Constants.LineItem.EntityName, target.Id, new ColumnSet(attrName));
budgetLine.Id = target.Id;
budgetLine[attrName] = new Money(value);
this.Context.UserOrgService.Update(budgetLine); - this throws the error "Index (zero based) must be greater than or equal to zero and less than the size of the argument list."
But the attrName which I'm trying to update is getting updated with value sometimes. This all sprang up after checking this functionality is working fine and froze the code within a span of 8 hours post that the exact same code is throwing this error, I'm unable to figure out the root cause any suggestions or advice is appreciated
Thanks,
Vinod Pagadala
*This post is locked for comments