From time to time, we’ve experienced an issue where an order or cart calculation request to Business Central wound return an error saying something like:
“The Sales Header does not exist. Identification fields and values: Document Type='Order',No.='SO0035896'”
When we receive these kinds of errors, it is usually because another extension in Business Central is subscribing to an event in the sales header creation and expecting some data, that the Plug-In Unit hasn’t populated on the sales header yet. We’ve had similar issues when calculating live orders, and we’ve felt forced to remove extensions one by one to narrow down the culprit.
But now, since we have the DynamicWeb Plug-In Unit Test Tool, we can run the request inside Business Central, so I tested out the following approach and got a very helpful result.
I went in to the Performance Profiler and hit the “Start” button:
I launched the Test Tool page and pasted the failing request XML into the “Request” field. This returned the same error message:
I went back to the Performance Profiler and hit the “Stop” button. I ticked the “Show technical information” button, scrolled down and expanded the “Call Tree” section. Here, I expanded the tree and noticed a third party extension that subscribed to the SalesHeaderOnBeforeValidateSellToCustomerNo event:
I then went into “Extension Management” and uninstalled this app, and now, when running the request in the Test Tool, the order was created successfully:
Now, I wish this worked in the first run (“it worked yesterday” 😉), but I had to make a few attempts. The first time I did the test, there was not trace of the third party app, so I tried decreasing the sampling interval of the Performance Profiler:
It still didn’t show up, so after a few attempts I decided to uninstall the “Dynamicweb Plug-In Unit” and install it again to slow down the system, and voilá, then I got a more detailed picture including the app that was throwing the error.
Hope this can help others in a similar situation - have a great day 😊