Skip to main content

Notifications

Community site session details

Community site session details

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

Delete Invoice in BC

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I know this question has been asked a lot before, but we need to delete a posted invoice or credit note in BC.

I also know that there are some partners extension able to delete posted documents/credit notes.

Microsoft documentation says it is not possible, but how those partners can achieve this goal using AL Code?

Thanks in advance.

  • Suggested answer
    YUN ZHU Profile Picture
    81,711 Super User 2025 Season 1 on at
    RE: Delete Invoice in BC

    Hi, you can refer to codeunit 80 "Sales-Post", an additional Permissions property is set, so the post data can be inserted, modified and deleted.

    https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/properties/devenv-permissions-property

    pastedimage1661386286239v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Amit Baru Profile Picture
    3,029 on at
    RE: Delete Invoice in BC

    Hi,

    As per the compliance, you should reverse the transaction rather than delete. If you delete the posted document then there is no authenticity of data and standard ERP.

    Regards

    Amit Sharma

    www.erpconsultors.com

    www.linkedin.com/.../  

    Press Yes if information is reliable.

  • FScott Profile Picture
    5 on at
    RE: Delete Invoice in BC

    Hello,

    sorry for the late answer.

    You're all correct on how to delete an invoice in BC and you're also correct about all the legal and consistency aspects.

    There are however some specific use cases where a document must be deleted because of a duplicated invoice number (I think this was a little glitch in BC). This specific problem was solved with an environment rollback by Microsoft.

    Anyway, the suggested "native method" will delete the document, but not the transaction which cannot be deleted in BC (and for a good reason I may add).

    However I found out that there are some extensions (by third party and maybe not exactly "approved") that can delete an invoice and all transactions associated with it (with some limits).

    At this point I think those extensions are using some undocumented method because when I tried to delete a transaction, an error was raisen.

    We will try the third party extensions suggested here, but we're still curious to know how they achieve that, even just for emergency cases.

    Thanks.

  • Suggested answer
    TMNielsen Profile Picture
    44 on at
    RE: Delete Invoice in BC

    Additional info.

    I have now also tried to delete a purchase invoice. The problem is the same, BUT this time the documentation was correct "If you enter a date, posted purchase documents with a posting date on or after this date cannot be deleted"

    So i tested one more time deletion of a posted credit note and this time it was possible to delete a purchase credit note if the date in the 'Purchase & Payables Setup'  is HIGHER than the invoice date. I am 100% sure that it worked the other way around the first time I delete a posted credit note, so there may also be some kind of error in this date controlled logic.

    Anyway the basic functionality to delete posted documents is corrupting data and it should be blocked!

  • Suggested answer
    TMNielsen Profile Picture
    44 on at
    RE: Delete Invoice in BC

    W A R N I N G

    Its not clear to me if you mean purchase or sales, but  I have tested deletion of a purchase credit note and I got a problem, that you should know about.

    I tested the function to delete by setting a date in the "Allow Document Deletion' before field - as described by andy4029.

    I created a posted credit note and deleted it again. At first it looked fine - I was able to delete the credit note and it really does not exist in the list of posted credit notes.

    BUT if I go to the vendor I first of all see that credit note is still included in the Balance and if I open the list with Vendor Ledger Entires, the credit note also exist there. The related G/L entries does also still exist. This is in my opinion all bad and I'm sure this is not what you wish to happen.

    I admit I have only made one single with one scenario, but I would still say that Microsoft should remove the delete function, because the result is data inconsistency.

    Also note that the documentation if you move the cursor over the label "Allow Document Deletion Before" is wrong. It says "If you enter a date, posted purchase documents with a posting date on or after this date cannot be deleted", but it is the other way around, so the "cannot" should be a "can".

    Best regards

    Thomas Madsen Nielsen

  • Suggested answer
    YUN ZHU Profile Picture
    81,711 Super User 2025 Season 1 on at
    RE: Delete Invoice in BC

    Hi, hope the following helps.

    4 WAYS TO DELETE RECORDS FROM A TABLE

    https://navinsights.net/2020/10/27/4-ways-to-delete-records-from-a-table/#:~:text=Use%20the%20search%20function%20(tell,again%20to%20update%20the%20list.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,021 Moderator on at
    RE: Delete Invoice in BC

    Hi, as Andy said posted documents can be deleted.

    But based on your question i assume you also want to delete the data in transaction table.

    Technically that is not a complex operation but you need to do it carefully not to break the consistency of your finance data.

    In some region, mine included, it is illegal to delete transactions that are already posted, so the right way to do it with correction posting.

    If there really is a need to delete transactions i recommend you discuss that with your partner to make sure they can verify that it is really needed and assist you in doing that.

  • Suggested answer
    AD-22040756-1 Profile Picture
    632 on at
    RE: Delete Invoice in BC

    1. I am just wondering what is the business reason you need to delete it? Its always better to leave it and reverse it if needed rather than deleting it, or create other accounting entries. 

    2. Business Central actually allows deleting posted invoices and credit memos. Look at the 'Allow Document Deletion Before' field in the 'Purchase & Payables Setup' and 'Sales & Receivables Setup' 

    If you enter a date, posted purchase documents with a posting date on or after this date cannot be deleted, but documents with an earlier date can be deleted. However, I would not recommend this. 

    pastedimage1659647130284v1.png

    3. Other than a few restricted tables, any data in most tables can be deleted or modified without validation. For example, a free extension that does this: https://vld-nav.com/table-data-editor-for-bc of course keeping in mind I would not recommend doing this other than for special situations or reasons 

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,219 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,980 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans