AxdSalesorder Update with SalesSalesorderService AX 2012

Hello,

I am trying to update my salesorder (previously created using the AX Client App). When I am trying to update the SO i am facing the following error:

System.ServiceModel.FaultException: Specified cast is not valid.

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)

I tried anything i can, i searched a lot of forums. I am new to AX so my capabilities are a little bit short.

Can anyone please advise?

Best Regards,

Thank you.

How do you call the service? Does it depend on particular fields/values? If you debug the operation in AX, where does it fail?

Hello Martin,

After debugging the X++ code from my .NET application, i have discovered where my code is giving the error:

My error is happening on the StaticValue_LT field (AxSalesLine.parmStatisValue_LT method), even if i include a value in my code (0… it is a decimal field) it is still giving the same error.

the error is being triggered on the line : currentRecord.(_fieldId) = _anyType; //AxInternalBase.setField method

because _anyType is 0 for the _fieldId= 16003 (which is StaticValue_LT)

There is a Hot fix that claims to resolve this problem. Here is the link to the KB (2972669) for it:

https://fix.lcs.dynamics.com/Issue/Resolved/616266?kb=2972669&bugId=1690299&qc=fd6d463fec845f358896061eb0076f31