web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

vatProdPostingGroup set to empty by API

(0) ShareShare
ReportReport
Posted on by 39

Hello, and thanks for any help,

    we are inserting product orders programmatically via custom API calls. Our APIs are simple and just expose all the order fields that get filled.

Orders get inserted regularly and then for every order, many product lines are added.

We are in a multicompany environment. With "companies", hereon, I mean our companies, not the orders' ones, We switch company environment in BC and orders are programmatically inserted in the correct company environment by the software and API.

This works fine both on both sandbox and production environments, and for multiple companies, except for the following problem.

Any order line has a vatProdPostingGroup field set to the same constant value, but, only for some of our companies, for no apparent reason, after the insertion, this order field is left empty (for all the lines of all orders in that company envirnoment).

The same order line data gets inserted in two different ways depending on the company.envirnoment.

Company A, production, same order data -> vatProdPostingGroup filled
Company B, production, same order data -> vatProdPostingGroup empty
Company A, sandbox, same order data -> vatProdPostingGroup empty

As an example, connecting to the API and sending this payload data via Postman:

{
"documentNo":"21OV0036",
"documentType":"Order",
"type":"G\/L Account",
"no":"05.01.001",
"description":"N.10010 di YYY YYYYY",
"locationCode":"01",
"quantity":-2,
"unitPrice":2,
"lineDiscount":28.35,
"lineAmount":-2.866,
"qtyToShip":-2,
"qtyToInvoice":-2,
"plannedDeliveryDate":"2021-03-10",
"plannedShipmentDate":"2021-03-10",
"shipmentDate":"2021-03-10",
"shortcutDimension1Code":"FASU\/10",
"shortcutDimension2Code":"R01001",
"ShortcutDimCode3":"EIT",
"vatProdPostingGroup":"NI.A74C1",
"vatBusPostingGroup":"NAZ",
"lineNo":301
}

The order line is inserted, without any error, and the response given back by the API is:

    "@odata.etag": "W/\"..........\"",
    "id": "...........",
    "documentType": "Order",
    "lineNo": 301,
    "documentNo": "21OV0036",
    "vatProdPostingGroup": "",
    "vatBusPostingGroup": "NAZ",
    "type": "G/L Account",
    "no": "05.01.001",
    "description": "N.10010 di YYY YYYYY",
    "locationCode": "01",
    "quantity": -2,
    "unitPrice": 2,
    "lineDiscount": 28.25000,
    "lineAmount": -2.87,
    "qtyToShip": -2,
    "qtyToInvoice": -2,
    "plannedDeliveryDate": "2021-03-10",
    "plannedShipmentDate": "2021-03-10",
    "shipmentDate": "2021-03-10",
    "returnQtytoReceive": 0,
    "shortcutDimension1Code": "FASU/10",
    "shortcutDimension2Code": "R01001",
    "ShortcutDimCode3": "EIT"
}

As you can see by the sixth line of the response,  "vatProdPostingGroup": "", the vatProdPostingGroup field is empty, and such is also in the order view in the BC program..

For some other company, the same payload, with the same coding, API included, and the same vatProdPostingGroup value, the value is preserved and inserted regularly in the order. Nothing is changed except the company, so it must be something in the setup of the company / environment that interferes with this field.

Any clues why this might happen?

Excluded options:

- We already excluded software problems (both program and api are the same and the vatProdPostingGroup is set by one simple constant assignment, and the example i showed is performed in Postman (an external API simulation program) so it is independent from our code.

- it is not a wrong value: a missing or wrong vatProdPostingGroup generates an error, so this is not the case. For example, removing the group code from the VAT Setup page causes the import to fail with an error. Instead, this succeeds, but silently sets the field to empty / null.

What else may I try?

I have the same question (0)
  • Verified answer
    Suresh Kulla Profile Picture
    50,233 Super User 2025 Season 2 on at
    RE: vatProdPostingGroup set to empty by API

    Check the respective G/L Account/Item Card and see what value you have specified on the VAT Prod Posting Group

  • Alberto Zamburlini Profile Picture
    39 on at
    RE: vatProdPostingGroup set to empty by API

    Thanks.

    Sorry but i know little about setup... Is this the right place?

    if yes....where????

    Thank u.

    pastedimage1633540105514v1.png

  • Suggested answer
    JAngle Profile Picture
    121 on at
    RE: vatProdPostingGroup set to empty by API

    Suresh is referring to the G/L Account card page. Accessed from the chart of accounts (based on your example data). Not sure it will benefit though. As you set the VAT fields after not before the G/L Account is validated - at which point it picks up the data from the record for those fields in question

    The order of the data being passed is something I picked up on. The VAT business after the VAT product? Other way round makes more sense. I’d also expect you not to use the VAT business as that comes from the customer/vendor record

  • Verified answer
    Suresh Kulla Profile Picture
    50,233 Super User 2025 Season 2 on at
    RE: vatProdPostingGroup set to empty by API

    Not GL Setup but G/L Account Card, check this

    docs.microsoft.com/.../finance-setup-chart-accounts

    since the same code is working in one company but not another, I am not sure if the order of fields will cause this issue.

  • Alberto Zamburlini Profile Picture
    39 on at
    RE: vatProdPostingGroup set to empty by API

    Thank you, it worked

  • Suggested answer
    Alberto Zamburlini Profile Picture
    39 on at
    RE: vatProdPostingGroup set to empty by API

    Thank you guys. Fixed:

    - type "Chart Of accounts" in the search field, click on  Chart Of accounts link

    - look for the correct account number based on the JSON

    "type":"G\/L Account",

    "no":"05.01.001",

    - Open the card for correct account, in my case 05.01.001

    - set the vat Prod. Posting Group code to that of the JSON, in my case NI.A74C1

    probably setting the vat Prod. Posting Group  ion the JSON is useless, not tested yet

  • Verified answer
    Samantha73 Profile Picture
    3,195 on at
    RE: vatProdPostingGroup set to empty by API

    my comment on "probably setting the vat Prod. Posting Group  ion the JSON is useless, not tested yet"

    You should be able to update this via API and this is the reason it's exposed on the API.  I haven't tried prod orders but on invoices I could update default from API.  I'd be more comfortable with API assigning the value as you can eliminate user errors in setting up GL accounts and the solution is more flexible to accommodate future needs

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 4,275

#2
Sumit Singh Profile Picture

Sumit Singh 2,677

#3
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 2,526

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans