Can anyone please provide me C# code to update sales order through web service.
I have tried same but getting error “Document Sales order could not be updated. Error details: The document hash does not match the hash in the XML. The document may have been changed since last read”.
Please provide me the code…
It seems that you already know how to call update, but you’re sending invalid data or the document has really changed meanwhile. Have you obtained the document by the read operation?
Thanks for your reply…
I have obtained the document by read operation. But , it is giving document hash error at the time of updation.
Is there a way to get the current hash code ,so that updation can be made successfully…
Do you have any piece of code in which u have updated some records in sales line? AS i have checked several ways to perform it but not able to figure out…
It will be of great help for me…
It don’t see the point in spending time writing such code - it wouldn’t show anything more than “get a document from the read operation … change a property … call the update operation”. If you want to discuss a specific code, show us your code.
Regarding the hash, it’s somewhere in the document header. You can, for example, look at message’s XML or check out AxdBaseRecordInfo.getRecordHash() in debugger (I believe that the hash is calculated there).
I am using attached code for updating sales line.
But when i am executing code it is giving me error:
Document Sales order could not be updated. Error details: The document hash does not match the hash in the XML. The document may have been changed since last read
Pls. have a look…
readupdateSalesorder.pdf (130 KB)
The code works fine. I only changed SalesId and removed the reference to company (since I didn’t need it).
I can reproduce your problem only by simulating an update conflict. I interrupt the application after reading the order, change the line in AX and continue with execution of the application. That’s likely what happens in your case too. Note that records may be changed by code as well as users.
Thanks for evaluating my code.But i am getting error when update script is executing.
Records will be changed from outside not by users.
We will change records only by code…
So please have a look on update operation…
Again: the code works! You’re wasting time trying to fix the part of your application that works. You have to fix the update conflict.
Debug the service and find out where exactly it fails and then check what’s updating the same table before AIF.
Hello Martin, I hope you’re well. I want to know if they could already provide a solution to this problem, I would appreciate it very much. I have this same problem, and I’m in a development environment, where there is no competition, I’m the one I’m manipulating the document and do not understand why I throw this error. I debug my code in C #, and the FaultException throws me “The document hash does not match the hash in the XML. The document May Have Been changed since last read**.**”
- I read the document with a Read.
- I call the update (DocumentObject)
Please help with this one …