Hi Experts,
The situation below confuses me when I tried to send a request to create a sales order line if the line contains a cross reference number.
Recently, we exposed Business Central's original page of 'Sales Order Subform' as a web service for requests sending to create sales order lines.
But when the request contains a cross reference number that matched 2 records in the cross reference table, we got an error like this in the response, even though we already write unit of measure in the request which should be enough to narrow down to the only one that matched.
Our Records in Item Cross Reference Table is attached in the screenshot.
Our Request:
{
"Document_Type": "Order",
"Document_No": "TWH1201",
"Line_No": 20000,
"Type": "Item",
"Cross_Reference_No": "1896-1",
"Unit_of_Measure_Code": "PCS",
"No": "1896-S"
}
Error in Response:
{
"error": {
"code": "Internal_ServerError",
"message": "The following AL methods are limited during write transactions because one or more tables will be locked:\r\n\r\nForm.RunModal is not allowed in write transactions.\r\n\r\nCodeunit.Run is allowed in write transactions only if the return value is not used. For example, 'OK := Codeunit.Run()' is not allowed.\r\n\r\nReport.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'Report.RunModal(...,false)' is allowed.\r\n\r\nXmlPort.RunModal is allowed in write transactions only if 'RequestForm = false'. For example, 'XmlPort.RunModal(...,false)' is allowed.\r\n\r\nUse the commit method to save the changes before this call, or structure the code differently.\r\n\r\nContact your application developer for further assistance. CorrelationId: 8800a1a8-d853-4384-9a0d-cbf1a094d7ef."
}
}
We know that if we operating this on Business Central UI, it will pop up a modal for user to select one matched item number, but we have no idea if we can skip this through web service callings.
If any experts that encoutered this before, we were wondering if you could tell us how we should write in request to avoid the error above.
Thanks in the advance!

Report
All responses (
Answers (