Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

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

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

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans