Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Unanswered

Insertion of order lines via API fails

(0) ShareShare
ReportReport
Posted on by 39
Hello everyone, and thanks for your help.
 
: : : :   WORKING SITUATION   : : : :
 
    we have an automated system that inserts orders in Business Central using the BC API.
The system creates an order using a custom API and then adds lines to it using another API.
 
The system works adding the following fields to the order:
'sellToCustomerNo','documentDate','operationOccurredDate','postingDate','orderDate','yourReference','operationType','paymentTermsCode','documentType','EOSUserDefinedField20',
And then the following fields to the order line:
'documentNo','type','no','description','locationCode','quantity','unitPrice','lineDiscount','lineAmount','qtyToShip','qtyToInvoice','plannedDeliveryDate','plannedShipmentDate','shipmentDate','shortcutDimension1Code','shortcutDimension2Code','ShortcutDimCode3','documentType',
And, as said, all this is working correctly.
 
 
 
: : : :   MODIFICATION REQUEST   : : : :
 
The request is to add the
vatProdPostingGroup
vatBusPostingGroup
fields to the order line and the order, so that those fields are set correctly in the resulting orders.
 
 
 
: : : :   THE PROBLEM   : : : :
 
For the test order we have the following custom VAT code values:
 
vatProdPostingGroup: '22.S' (our normal 22%VAT)
vatBusPostingGroup: 'NAZ' (national customers)
 
When adding those fields we get different results (error or no field added) depending on the situation.

1) Initially, adding the vatProdPostingGroup field to the line and the vatBusPostingGroup to the order we got an error:
 
The VAT Posting Setup does not exist. Identification fields and values:
VAT Bus. Posting Group='',VAT Prod. Posting Group='022.S'
 
This shows that the Vat Bus Posting Group is totally ignored (instead of 'NAZ' it is set to an empty string) and BC complains the combination ( empty, '22.S' ) is not registered in VAT Posting Setup. The order is left empty, with no lines, but the VAT Bus Posting Group is correctly set to NAZ (!!)
 
 
2) Adding the combination of ( '' empty , '22.S' ) in VPS:

 
avoids the error, and the line is correctly added to the order, but (and this was very surprising) the VAT Prod Posting Group is left empty!
 
 
So, first BC complained about not beeing ableto add a line with said VAT Posting- After adding the right combo, it added the line without the VAT posting.
 
At this point we have no clue. Any help is apprecieted.
 
Thanks for any suggestion you can give us... for any doubt or clarification please ask.
 
 
  • Insertion of order lines via API fails
    Nobody?
  • Insertion of order lines via API fails
    Any idea why this happens?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans