Skip Sales Order Document deletion when it is fully posted

Skip Sales Order Document deletion in Business Central:

(1) Sometimes businesses required Sales Order Document in a system when it is fully posted because in
D365 BC sales order document auto delete when it is fully posted.

(2) For doing this, call “OnBeforeDeleteAfterPosting” event for skip Sales order document to delete.

Source Code in AL:

OnBeforeDeleteAfterPosting source code for sales order
codeunit 50001 “Custom Functions-01”
    trigger OnRun()
    [EventSubscriber(ObjectType::Codeunit, Codeunit::”Sales-Post”, ‘OnBeforeDeleteAfterPosting’, ”, true, true)]
    procedure OnBeforeDeleteAfterPostingSale(var SalesHeader: Record “Sales Header”;
    var SalesInvoiceHeader: Record “Sales Invoice Header”;
    var SalesCrMemoHeader: Record “Sales Cr.Memo Header”;
    var SkipDelete: Boolean;CommitIsSuppressed: Boolean; EverythingInvoiced: Boolean);
        SkipDelete := True;

(3) After writing the above code and publishing the code and the system will auto handle the document skip functionality.

Skip Purchase Order Document deletion when it is fully posted
How to get Days from Month in D365 BC
Main Features of Dynamics 365 Business Central
Extension Fields Not Visible in Page in D365 WebClient- Solved
Dynamics 365 Business Central pricing– Microsoft Docs

Leave a Reply