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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

REST API - Find out whether a sales invoice has been posted

(0) ShareShare
ReportReport
Posted on by 15

Hi,

We'd like to use the Dynamics Business Central REST API to find out if a sales invoice has been posted.

There's no "posted" field on the salesInvoice API endpoint. However, it does have a "status" field. Can this field be used to determine posted status?

From some quick experimentation, it seems that "Draft" == not posted, and "Open"/"Paid" == posted. But I'm not sure if this is 100% reliable.

I also found this page, which seems to suggest it cannot be relied on: https://experience.dynamics.com/ideas/idea/?ideaid=662fd581-c9b8-e911-b083-0003ff689d13

Any help would be appreciated!

I have the same question (0)
  • Suggested answer
    Javier.Armesto Profile Picture
    14 User Group Leader on at

    Hello, you would have to check two fields:Sales Document Status and yet another status field, based on the enum Invoice Entity Aggregate Status what is it that you are checking.

    Invoice Posted :

    Sales Document Status==released & &

    Invoice Entity Aggregate Status”==Open or paid.

    Status fields have a different meaning in APIs than in Business Central

    Este post te ayudara: https://www.kauffmann.nl/2021/04/16/extending-standard-apis-2/

    If the answer has served you, please check the answer. It is helpful for other users. 

  • Nick22 Profile Picture
    15 on at

    Thanks for your reply. Would you happen to know if the Sales Document Status is available through the REST API? I looked for it but couldn't find it.

  • Suggested answer
    Javier.Armesto Profile Picture
    14 User Group Leader on at

    The option would be to make a custom API and add that field. The approach would be to clone the page api salesinvoices and extend the field . You can consult: github.com/.../app

  • Nick22 Profile Picture
    15 on at

    We were hoping to avoid writing a custom API, but regardless that's good to know. Thank you for your help!

  • Suggested answer
    Javier.Armesto Profile Picture
    14 User Group Leader on at

    The If you don't want to code a custom api in AL. This might help:

    Posted Date is the date that sales invoice is Posted. If inot null with combination the field Status  Open or Paid value.

    Maybelline is a solution for you.

    Remember to mark as a valid solution if I have been of help. Other users will be able to consider this answer for a similar problem

  • Nick22 Profile Picture
    15 on at

    Thank you for the suggestion. I looked into to this, however, the postingDate field can be set even if the invoice is in a draft state.

    So it seems like it cannot be used to differentiate posted vs non posted unfortunately.

  • Gabriel Prinz Landeo Profile Picture
    35 on at

    Perfecto

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,135

#2
YUN ZHU Profile Picture

YUN ZHU 733 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 612

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans