I have a PHP script that inserts Quotes for us. The basic procedure is:
This has been active for years and works fine. Today I started a new script that needs to insert Sales Lines onto Orders instead of Quotes. The final insert is literally exactly the same as the Quote insert (using all of the same code), except two fields are different:
Unfortunately this fails every time, with this error:
"The field Document No. of table Sales Line contains a value (SO56789) that cannot be found in the related table (Sales Header)."
Looking at the tables in Nav, the Sales Line table has column 'Document No.' with value 'SO56789' and the Sales Header table has column 'No.' with value 'SO56789'. I can't figure out why it fails. It's worth emphasizing that this works fine as a quote - all code is exactly the same, column names are the same, etc.
Is there some other field I have to pass to insert a line on an Order document?
I'm not sure if this is what you were getting at Suresh but I checked the Keys for each table in question (Sales Header and Sales Line), then I compared them to the Web Services Pages I had created (WS_SalesHeader and WS_SalesLine). They were not in the same order.
For example the Keys for Sales Header table were 'Document Type,No.' and Keys for Sales Line were 'Document Type,Document No.,Line No.'.
Meanwhile my WS_SalesLine had the columns in this order: 'Document No., Line No., <other columns>, Document Type'. My WS_SalesHeader had the columns in this order: 'Document Type, <other columns>, No.'.
So I changed my Services so the keys were defined first, and in the same order as the actual table definitions. That solved the problem - Sales Lines are now inserted correctly for both Quotes and Orders.
I'm not sure why these Web Services worked fine for Quotes but failed for Orders, but at least it's working now.
how are the web services published? If they have published a sales quote or something which has the filter for document type then you cannot create an order using the same service.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156