Skip to main content
Business Central forum
Suggested answer

How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

editSubscribe (0) ShareShare
ReportReport
Posted on by 15

We use the API (v2) to export journal lines to Business Central.

When we post an entry we don't have all the features like when we enter manualy a line, especially concerning taxes.

We only have a field "taxCode". But the system ignores what is set in this field and when we edit the journal on Business Central, it seems settings are still the default for the account. 

Does someone has any idea how to correct this behaviour ?

Have a nice day 

Steve

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    Hello,

    You can of course raise a feature suggestion via https://aka.ms/bcideas . We are open for suggestion. Also you can verify what is exposed out of the box and what has not been exposed yet via:

    api.businesscentral.dynamics.com/.../$metadata

    Hope at least this helps.

  • SteveMet Profile Picture
    SteveMet 15 on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    thanks for the answer...

    I am little bit disappointed that the standard API doesn't allow to post standard bookkeeping entries :(

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    Hello,

    Thank you for the message. Now I see what you mean. The field taxCode is linked to VAT Prod. Posting Group. You want to populate data in field VAT Bus. Posting Group. I assume that these have been been populated in the API, so you need to create a custom API for t his where you expose these yourself.

    Hope it helps.

  • SteveMet Profile Picture
    SteveMet 15 on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    I use BC online, I don't know where to find the version ? I tried to find "version" in the search menu, without success.

  • SteveMet Profile Picture
    SteveMet 15 on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    Thanks for the suggestion, unfortunately, how to specify "VAT Bus. Posting Group", if we can only set "taxCode", which I guess is "VAT Prod. Posting Group". Here is the table of my customer (VAT posting setup) :

    2022_2D00_10_2D00_18_5F00_17_2D00_33_2D00_22.png

    if I post "NORMAL" in the taxcode, how or where to post "NATIONAL" or "EXPORT" ?

  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    Hello,

    At my side it works fine:

    pastedimage1665747464097v1.png

    api.businesscentral.dynamics.com/.../{{TENANTAADID}}/{{PRODUCTION}}/api/v2.0/companies({{COMPANY}})/journals({{JournalID}})/journalLines

    {
      "Description""Test1",
      "accountNumber" "10000",
      "taxCode""FULL RED"
    }
    This is tested in BC21 SaaS. What release are you testing with?
    Thanks.
  • SteveMet Profile Picture
    SteveMet 15 on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    POST {{baseUrl}}companies({{companyId}})/journals({{journalId}})/journalLines
    {
      "accountNumber": "3203",
      "postingDate": "2022-10-12",
      "documentNumber": "1234",
      "amount": 1300,
      "description": "test",
      "comment" : "test comment",
      "taxCode" : "NORMAL"
    }

    this works to post a new line in a journal. But in the documentation it seems there is no way to fill these fields in

    pastedimage1665642023248v1.png

    in the documentation, these fields don't seem to appear : 

    journalLine resource type - Business Central | Microsoft Learn

    pastedimage1665642137255v2.png

    Seems that these fields are set directly from the config of each account. 

  • Marco Mels Profile Picture
    Marco Mels on at
    RE: How to post a journal entry with VAT (taxCode) settings different than the default (via the API)

    Hello,

    Best probably is to post your JSON so anyone can take a look.

    Thank you.

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,045 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,570 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans