I am trying to increment an item in a list by 1 from a workflow that is kicked off from another list, but when the workflow runs I am getting an "Unable to Cast Result" error. I see the the return type of Sum() can be either Number or Decimal and the filed I am trying to update is of Decimal type. I have wrapped the sum function in ToDecimal to make sure it is returning what I need and I have also wrapped the 1 in ToDecimal to make sure that I am adding like datatypes. Has anyone had this issue before? Below is the trace from the workflow error if it helps.
Server stack trace:
at SourceCode.Workflow.Runtime.Extenders.CodeExtender.OnExecute(Object context, XmlElement data, ResolverManager resolverManager)
at SourceCode.Workflow.Runtime.Extenders.ResolverExtenderBase.Execute(Object context, String data)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
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 SourceCode.Workflow.Runtime.IK2Extender.Execute(Object context, String data)
at SourceCode.KO.ProcessInstance.ExecuteExtender(Guid , State , ContextType , Object , Int32 , String , Guid )