Unable to Cast Result with Sum Function

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 )



0 Kudos
2 Replies

Re: Unable to Cast Result with Sum Function

Hey Mike,


How are you trying to increment the list item?  Can you post any screenshots?


Thanks, and regards,


0 Kudos

Re: Unable to Cast Result with Sum Function

Hello Mike,


Along with what Jake is asking for I was wondering if you might be able to provide some more information about the lists you have created? I am trying to reproduce this and the more info we can get about your set up the better.




0 Kudos