How to Prevent Deletion Of Sales Order - Only if by end user?

samantha73samantha73 Member Posts: 106
I'm trying to impement an event driven validation to prevent SO deletion however it also block base app deleting sales order after invoicing. How do I exclude system deleting?
The event:
[EventSubscriber(ObjectType::Table, Database::"Sales Header", 'OnBeforeDeleteEvent', '', false, false)]
    local procedure OnBeforeDelete(var Rec: Record "Sales Header"; RunTrigger: Boolean)
    var
        SalesSetup: Record "Sales & Receivables Setup";
    begin
        if Rec.IsTemporary then
            exit;
        if RunTrigger then
            exit;

Answers

  • Developer101Developer101 Member Posts: 541
    Hello, what do you require exactly? As I understood you want to prevent users to delete Sales Orders, is that correct?
    What is NAV or BC version?
    United Kingdom
Sign In or Register to comment.