{"title":"Types of events for extensibility","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/types-of-events-for-extensibility/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/types-of-events-for-extensibility, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/types-of-events-for-extensibility","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"This article describes various types of events for extensibility.","date":"2026-10-29","meta":{"topic":"article"},"outline":[{"level":2,"title":"Types of events","slug":"types-of-events","at":645,"chars":21286},{"level":3,"title":"Business events","slug":"business-events","at":1092,"chars":7538},{"level":4,"title":"OnBefore/OnAfter Events","slug":"onbeforeonafter-events","at":2235,"chars":237},{"level":4,"title":"Before or after an operation","slug":"before-or-after-an-operation","at":2472,"chars":1387},{"level":4,"title":"Before or after a procedure","slug":"before-or-after-a-procedure","at":3859,"chars":1056},{"level":4,"title":"Before or after a specific line","slug":"before-or-after-a-specific-line","at":4915,"chars":3715},{"level":3,"title":"Verify events","slug":"verify-events","at":8630,"chars":2332},{"level":3,"title":"Isolated events","slug":"isolated-events","at":10962,"chars":3147},{"level":3,"title":"Switch events (manually bound events)","slug":"switch-events-manually-bound-events","at":14109,"chars":1765},{"level":3,"title":"OnSkip (operation) events","slug":"onskip-operation-events","at":15874,"chars":2351},{"level":3,"title":"Handled events","slug":"handled-events","at":18225,"chars":2129},{"level":3,"title":"Discovery events (mostly obsoleted)","slug":"discovery-events-mostly-obsoleted","at":20354,"chars":1577},{"level":2,"title":"Related information","slug":"related-information","at":21931,"chars":85}],"text":"Use events to design the application to react to specific actions or behaviors. Events let you separate custom functionality from the application's business logic. By using events where customizations are typically made, you lower the cost of code modifications and upgrades to the original application.\nThis article describes the types of integration events, and the events that we consider as high, medium, and low quality. How we define these rankings varies, depending on factors such as:\n The number of times they're implemented.\n How easy they are to maintain when you refactor code.\nTo learn more about events, go to devenv-events-in-al.\n## Types of events\nThe following list includes the types of events that are available. Use the links to learn more about them.\n #business-events\n OnBefore/OnAfter Events<#onbeforeonafter-events>\n   #before-or-after-an-operation\n   #before-or-after-a-procedure\n   #before-or-after-a-specific-line\n #verify-events\n #isolated-events\n #switch-events-manually-bound-events\n #onskip-operation-events\n #handled-events\n #discovery-events-mostly-obsoleted\n### Business events\nVery High Value - Use business events to notify subscribers that a specific business event has occurred.\nExamples:\n OnRejectApprovalRequest(var ApprovalEntry: Record \"Approval Entry\"),\n OnApproveApprovalRequest(var ApprovalEntry: Record \"Approval Entry\"),\n```al\ncodeunit 1535 \"Approvals Mgmt.\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnApproveApprovalRequest(var ApprovalEntry: Record \"Approval Entry\")\n    begin\n    end;\n}\n```\n```al\n    local procedure ApproveSelectedApprovalRequest(var ApprovalEntry: Record \"Approval Entry\")\n    var\n        IsHandled: Boolean;\n    begin\n        IsHandled := false;\n        OnBeforeApproveSelectedApprovalRequest(ApprovalEntry, IsHandled);\n        if IsHandled then\n            exit;\n        CheckOpenStatus(ApprovalEntry, \"Approval Action\"::Approve, ApproveOnlyOpenRequestsErr);\n\n        if ApprovalEntry.\"Approver ID\" <> UserId then\n            CheckUserAsApprovalAdministrator(ApprovalEntry);\n\n        ApprovalEntry.Validate(Status, ApprovalEntry.Status::Approved);\n        ApprovalEntry.Modify(true);\n        OnApproveApprovalRequest(ApprovalEntry);\n    end;\n```\n#### OnBefore/OnAfter Events\n`OnBefore/After` events vary in terms of quality, depending on where they're implemented.\n`OnBefore/After` events might not allow the code to override existing behavior just to add additional logic to flows.\n#### Before or after an operation\nHigh Value - If events are implemented before or after a large operation starts, they're high quality.\nExamples of high-quality events are:\n OnAfterPostSalesDoc\n OnBeforeSendEmail\n OnAfterEmailSent\n```al\ncodeunit 80 \"Sales-Post\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnAfterPostSalesDoc(var SalesHeader: Record \"Sales Header\"; var GenJnlPostLine: Codeunit \"Gen. Jnl.-Post Line\"; SalesShptHdrNo: Code[20]; RetRcpHdrNo: Code[20]; SalesInvHdrNo: Code[20]; SalesCrMemoHdrNo: Code[20]; CommitIsSuppressed: Boolean; InvtPickPutaway: Boolean; var CustLedgerEntry: Record \"Cust. Ledger Entry\"; WhseShip: Boolean; WhseReceiv: Boolean; PreviewMode: Boolean)\n    begin\n    end;\n}\n```\n```al\n    internal procedure RunWithCheck(var SalesHeader2: Record \"Sales Header\")\n    var\n        SalesHeader: Record \"Sales Header\";\n        CustLedgEntry: Record \"Cust. Ledger Entry\";\n        ...\n        if not (InvtPickPutaway or SuppressCommit or PreviewMode) then begin\n            Commit();\n            UpdateAnalysisView.UpdateAll(0, true);\n            UpdateItemAnalysisView.UpdateAll(0, true);\n        end;\n\n        OnAfterPostSalesDoc(SalesHeader2, GenJnlPostLine, SalesShptHeader.\"No.\", ReturnRcptHeader.\"No.\", SalesInvHeader.\"No.\", SalesCrMemoHeader.\"No.\", SuppressCommit, InvtPickPutaway, CustLedgEntry, WhseShip, WhseReceive, PreviewMode);\n```\n#### Before or after a procedure\nMedium Value - We often use these events to provide more processing before or after a specific method is called.\nThese events are medium quality because they're connected to the specific procedure, but it's unclear how to handle them if the procedure is removed or changed.\n```al\ntable 900 \"Assembly Header\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnAfterGetSKU(AssemblyHeader: Record \"Assembly Header\"; var Result: Boolean)\n    begin\n    end;\n}\n```\n```al\n    local procedure GetSKU()\n    var\n        SKU: Record \"Stockkeeping Unit\";\n        Result: Boolean;\n    begin\n        if (StockkeepingUnit.\"Location Code\" = \"Location Code\") and\n           (StockkeepingUnit.\"Item No.\" = \"Item No.\") and\n           (StockkeepingUnit.\"Variant Code\" = \"Variant Code\")\n        then\n            exit;\n\n        GetItem();\n        StockkeepingUnit := Item.GetSKU(\"Location Code\", \"Variant Code\");\n        Result := SKU.Get(\"Location Code\", \"Item No.\", \"Variant Code\");\n\n        OnAfterGetSKU(Rec, Result);\n    end;\n```\n#### Before or after a specific line\nLow Value - A valid use could be before we insert or modify a line to update specific fields. Otherwise, avoid them because the point to a specific line of code. They were needed before because the Hook pattern was used as a default extensibility.\nWe should carefully consider whether we need Hook events before we introduce them. Hook events have little reuse between extensions, and can be fragile to code changes.\nExample of valid use.\n```al\ncodeunit 5056 \"CustCont-Update\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnInsertNewContactOnBeforeContBusRelInsert(var ContactBusinessRelation: Record \"Contact Business Relation\"; Contact: Record Contact; Customer: Record Customer)\n    begin\n    end;\n}\n```\n```al\n    procedure InsertNewContact(var Cust: Record Customer; LocalCall: Boolean)\n    var\n        ContactBusinessRelation: Record \"Contact Business Relation\";\n        ...\n        ContactBusinessRelation.\"Contact No.\" := Contact.\"No.\";\n        ContactBusinessRelation.\"Business Relation Code\" := MarketingSetup.\"Bus. Rel. Code for Customers\";\n        ContactBusinessRelation.\"Link to Table\" := ContactBusinessRelation.\"Link to Table\"::Customer;\n        ContactBusinessRelation.\"No.\" := Cust.\"No.\";\n        OnInsertNewContactOnBeforeContBusRelInsert(ContactBusinessRelation, Contact, Cust);\n        ContactBusinessRelation.Insert(true);\n    end;\n```\nExample of a lower quality usage, because they could be grouped into a single event, rather than several:\n```al\ncodeunit 12 \"Gen. Jnl.-Post Line\"\n{\n    local procedure CalcPmtDisc(var NewCVLedgEntryBuf: Record \"CV Ledger Entry Buffer\"; var OldCVLedgEntryBuf: Record \"CV Ledger Entry Buffer\"; var OldCVLedgEntryBuf2: Record \"CV Ledger Entry Buffer\"; var DtldCVLedgEntryBuf: Record \"Detailed CV Ledg. Entry Buffer\"; GenJnlLine: Record \"Gen. Journal Line\"; PmtTolAmtToBeApplied: Decimal; ApplnRoundingPrecision: Decimal; NextTransactionNo: Integer; FirstNewVATEntryNo: Integer)\n    var\n        PmtDisc: Decimal;\n        PmtDiscLCY: Decimal;\n        ...\n\n        MinimalPossibleLiability := Abs(OldCVLedgEntryBuf2.\"Remaining Amount\" - OldCVLedgEntryBuf2.GetRemainingPmtDiscPossible(NewCVLedgEntryBuf.\"Posting Date\"));\n        OnAfterCalcMinimalPossibleLiability(NewCVLedgEntryBuf, OldCVLedgEntryBuf, OldCVLedgEntryBuf2, MinimalPossibleLiability);\n\n        PaymentExceedsLiability := Abs(OldCVLedgEntryBuf2.\"Amount to Apply\") >= MinimalPossibleLiability;\n        OnAfterCalcPaymentExceedsLiability(NewCVLedgEntryBuf, OldCVLedgEntryBuf, OldCVLedgEntryBuf2, MinimalPossibleLiability, PaymentExceedsLiability);\n\n        ToleratedPaymentExceedsLiability := Abs(NewCVLedgEntryBuf.\"Remaining Amount\" + PmtTolAmtToBeApplied) >= MinimalPossibleLiability;\n        OnAfterCalcToleratedPaymentExceedsLiability(NewCVLedgEntryBuf, OldCVLedgEntryBuf, OldCVLedgEntryBuf2, MinimalPossibleLiability, ToleratedPaymentExceedsLiability, PmtTolAmtToBeApplied);\n}\n```\nExample of a lower quality use where it's added for something very specific, which makes it hard to maintain.\n```al\ntable 900 \"Assembly Header\"\n    field(12; \"Variant Code\"; Code[10])\n    {\n        Caption = 'Variant Code';\n        TableRelation = \"Item Variant\".Code where(\"Item No.\" = field(\"Item No.\"), Code = field(\"Variant Code\"));\n\n        trigger OnValidate()\n        var\n            ItemVariant: Record \"Item Variant\";\n            IsHandled: Boolean;\n        begin\n            CheckIsNotAsmToOrder();\n            TestStatusOpen();\n            ...\n            IsHandled := false;\n            OnValidateVariantCodeOnBeforeValidateDates(Rec, xRec, IsHandled);\n            if not IsHandled then\n                ValidateDates(FieldNo(\"Due Date\"), true);\n   }\n```\n### Verify events\nMedium Value - Use verify events before or after the operation to check whether the business logic is correct.\nVerify events shouldn't create transactions. If the operation should be rolled back from an after event, make sure that the code before the event uses the `Ignore Commit` parameter.\nUse before events as early in the code as possible. We must avoid any risk of partial commits when we introduce verify events.\n```al\ncodeunit 370 \"Bank Acc. Reconciliation Post\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnBeforeFinalizePost(var BankAccReconciliation: Record \"Bank Acc. Reconciliation\")\n    begin\n    end;\n}\n```\n```al\n[Scope('OnPrem')]\n    [CommitBehavior(CommitBehavior::Ignore)] //Ignore commit\n    procedure RunPreview(var BankAccReconciliation: Record \"Bank Acc. Reconciliation\"): Boolean\n    begin\n        PreviewMode := true;\n        InitPost(BankAccReconciliation);\n        Post(BankAccReconciliation);\n        FinalizePost(BankAccReconciliation);\n        exit(true);\n    end;\n\n    local procedure FinalizePost(BankAccRecon: Record \"Bank Acc. Reconciliation\")\n    var\n        ...\n    begin\n        if PreviewMode then\n            exit;\n        OnBeforeFinalizePost(BankAccRecon);\n        CreationDateTime := BankAccRecon.SystemCreatedAt;\n        MatchedWithAI := AIMatchProposalsExist(BankAccRecon);\n        if BankAccReconLine.LinesExist(BankAccRecon) then\n            repeat\n                AppliedPmtEntry.FilterAppliedPmtEntry(BankAccReconLine);\n                AppliedPmtEntry.DeleteAll();\n\n                BankAccReconLine.Delete();\n                BankAccReconLine.ClearDataExchEntries();\n                LineCount += 1;\n\n            until BankAccReconLine.Next() = 0;\n\n        BankAccRecon.Find();\n        BankAccRecon.Delete();\n        TelemetryCategories.Add('Category', BankAccountRecCategoryLbl);\n        TelemetryCategories.Add('MatchedWithAI', Format(MatchedWithAI, 0, 9));\n        TelemetryCategories.Add('NumberOfLines', Format(LineCount));\n        if TryCalculateDurationToPost(DurationUntilPosting, CreationDateTime) then\n            Session.LogMessage('0000LHY', Format(DurationUntilPosting), Verbosity::Normal, DataClassification::SystemMetadata, TelemetryScope::ExtensionPublisher, TelemetryCategories);\n        OnAfterFinalizePost(BankAccRecon);\n    end;\n```\n### Isolated events\nMedium Value - Use isolated events to allow handling errors that won't interrupt the code execution.\nMultiple extensions can subscribe and do their processing. An error from one extension won't interrupt the transaction.\nIsolated events require a commit before invoking the code, and will commit before invoking the next subscriber. Therefore, they require a detailed review.\nAn alternative is to invoke `if Codeunit.Run()` and then handle things in isolation.\nCodeunit.Run requires an explicit commit before and has better testability, because there isn't an easy to test isolated events for error cases. To do error case testing, disable test isolation. Otherwise, the error eon't be handled.\nEvents are better than Codeunit.Run because they allow multiple subscribers. Running a codeunit only lets one implementation run at a time.\n```al\ncodeunit 6759 \"Create Reminders Action Job\"\n{\n    [IntegrationEvent(false, false, true)]\n    local procedure OnCreateReminderSafe(var Customer: Record Customer; var CustLedgEntry: Record \"Cust. Ledger Entry\"; var ReminderHeader: Record \"Reminder Header\"; OverdueEntriesOnly: Boolean; IncludeEntriesOnHold: Boolean; var FeeCustLedgEntryLine: Record \"Cust. Ledger Entry\"; var Success: Boolean)\n    begin\n    end;\n}\n```\n```al\n    local procedure CreateReminderForCustomer(var Customer: Record Customer): Boolean\n    var\n        Success: Boolean;\n    begin\n        Commit();\n        OnCreateReminderSafe(Customer, GlobalCustLedgEntry, GlobalReminderHeader, GlobalCreateRemindersSetup.\"Only Overdue Amount Entries\", GlobalCreateRemindersSetup.\"Include Entries On Hold\", GlobalFeeCustLedgEntry, Success);\n        if Success then\n            exit(true);\n\n        ReminderAutomationLogErrors.LogLastError(Enum::\"Reminder Automation Error Type\"::\"Create Reminder\");\n        ClearLastError();\n        exit(false);\n    end;\n```\n```al\ncodeunit 6761 \"Create Aut. Event Handler\"\n{\n    [EventSubscriber(ObjectType::Codeunit, Codeunit::\"Create Reminders Action Job\", 'OnCreateReminderSafe', '', false, false)]\n    local procedure CreateReminderSafeHandler(var Customer: Record Customer; var CustLedgEntry: Record \"Cust. Ledger Entry\"; var ReminderHeader: Record \"Reminder Header\"; OverdueEntriesOnly: Boolean; IncludeEntriesOnHold: Boolean; var FeeCustLedgEntryLine: Record \"Cust. Ledger Entry\"; var Success: Boolean)\n    begin\n        CreateReminders(Customer, CustLedgEntry, ReminderHeader, OverdueEntriesOnly, IncludeEntriesOnHold, FeeCustLedgEntryLine, Success);\n    end;\n\n    [CommitBehavior(CommitBehavior::Ignore)] //Ignore commit\n    local procedure CreateReminders(var Customer: Record Customer; var CustLedgEntry: Record \"Cust. Ledger Entry\"; var ReminderHeader: Record \"Reminder Header\"; OverdueEntriesOnly: Boolean; IncludeEntriesOnHold: Boolean; var FeeCustLedgEntryLine: Record \"Cust. Ledger Entry\"; var Success: Boolean)\n    var\n        ReminderMake: Codeunit \"Reminder-Make\";\n    begin\n        ReminderMake.Set(Customer, CustLedgEntry, ReminderHeader, OverdueEntriesOnly, IncludeEntriesOnHold, FeeCustLedgEntryLine);\n        ReminderMake.Code();\n        Success := true;\n    end;\n}\n```\n### Switch events (manually bound events)\nMedium Value - For switch events, the idea is to create an event that only manually bound subscribers should subscribe to.\nThen, early in the action, you can implement a manually bound subscriber that helps you change the behavior of that specific call.\n```al\nxmlport 1220 \"Data Exch. Import - CSV\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnNoLinesFoundSetErrorMessage(var ErrorMessage: Text);\n    begin\n    end;\n}\n```\n```al\n    trigger OnPostXmlPort()\n    var\n        ErrorMessage: Text;\n    begin\n        if (not LastLineIsFooter and SkipLine) or HeaderWarning then begin\n            ErrorMessage := LastLineIsHeaderErr;\n            OnNoLinesFoundSetErrorMessage(ErrorMessage);\n            Error(ErrorMessage);\n        end;\n    end;\n```\n```al\ntable 273 \"Bank Acc. Reconciliation\"\n{\n    procedure ImportBankStatement()\n    var\n        DataExch: Record \"Data Exch.\";\n        ProcessBankAccRecLines: Codeunit \"Process Bank Acc. Rec Lines\";\n    begin\n        CreateBankAccountReconcillation();\n        if BankAccountCouldBeUsedForImport() then begin\n            DataExch.Init();\n            BindSubscription(ProcessBankAccRecLines); //Bind\n            ProcessBankAccRecLines.SetBankAccountNo(Rec.\"Bank Account No.\");\n            ProcessBankAccRecLines.ImportBankStatement(Rec, DataExch);\n            UnBindSubscription(ProcessBankAccRecLines);\n        end;\n    end;\n}\n```\n```al\ncodeunit 1248 \"Process Bank Acc. Rec Lines\"\n{\n    [EventSubscriber(ObjectType::XmlPort, XmlPort::\"Data Exch. Import - CSV\", 'OnNoLinesFoundSetErrorMessage', '', false, false)]\n    local procedure HandleOnNoLinesFoundSetErrorMessage(var ErrorMessage: Text);\n    begin\n        InvalidFileFormatError(ErrorMessage);\n    end;\n}\n```\n### OnSkip (operation) events\nMedium Value - Skip events are similar to handled events. However, they can have multiple skip parameters, which gives us more granular control of the code.\nThe signature expects multiple subscribers, so there can be multiple extensions that handle the event.\nThe value ranking describes the event design, not whether an extensibility request is approved. Review considers the logic being bypassed, regardless of whether a Boolean parameter is named IsHandled, Handled, or Skip.... Requests that bypass existing logic can require the justification described in Minimum requirements for new IsHandled events<devenv-use-ishandled-min-req>.\n```al\ntable 36 \"Sales Header\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnAfterCopySellToCustomerAddressFieldsFromCustomer(var SalesHeader: Record \"Sales Header\"; SellToCustomer: Record Customer; CurrentFieldNo: Integer; var SkipBillToContact: Boolean; var SkipSellToContact: Boolean)\n    begin\n    end;\n}\n```\n```al\n    local procedure CopySellToCustomerAddressFieldsFromCustomer(var SellToCustomer: Record Customer)\n    var\n        IsHandled: Boolean;\n    begin\n        ...\n            OnCopySellToCustomerAddressFieldsFromCustomerOnBeforeUpdateLocation(Rec, SellToCustomer, IsHandled);\n            if not IsHandled then\n                UpdateLocationCode(SellToCustomer.\"Location Code\");\n        end;\n\n        OnAfterCopySellToCustomerAddressFieldsFromCustomer(Rec, SellToCustomer, CurrFieldNo, SkipBillToContact, SkipSellToContact);\n    end;\n```\nor\n```al\ncodeunit 5600 \"FA Insert Ledger Entry\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnInsertReverseEntryOnBeforeInsertMaintenanceLedgerEntryBuffer(var MaintenanceLedgerEntry: Record \"Maintenance Ledger Entry\"; var SkipInsertOfMaintenanceLedgerEntry: Boolean)\n    begin\n    end;\n}\n```\n```al\n    procedure InsertReverseEntry(NewGLEntryNo: Integer; FAEntryType: Option \" \",\"Fixed Asset\",Maintenance; FAEntryNo: Integer; var NewFAEntryNo: Integer; TransactionNo: Integer)\n    ...\n        OnInsertReverseEntryOnBeforeInsertMaintenanceLedgerEntryBuffer(MaintenanceLedgEntry3, SkipInsertOfMaintenanceLedgerEntry);\n        if not SkipInsertOfMaintenanceLedgerEntry then begin\n            TempMaintenanceLedgEntry := MaintenanceLedgEntry3;\n            TempMaintenanceLedgEntry.Insert()\n        end;\n```\n### Handled events\nLow Value - Handled events are low quality events.\n> NOTE\n> Subscribers must exit if the event is already handled, thus these events don't scale. Consider using skip events.\nBefore requesting a new handled event, review Using the IsHandled pattern<devenv-use-ishandled-pattern> and Minimum requirements for new IsHandled events<devenv-use-ishandled-min-req>. Changing an existing event to introduce handled behavior isn't accepted.\n```al\npage 42 \"Sales Order\"\n{\n    [IntegrationEvent(false, false)]\n    local procedure OnBeforeStatisticsAction(var SalesHeader: Record \"Sales Header\"; var Handled: Boolean)\n    begin\n    end;\n}\n```\n```al\n    action(Statistics)\n        {\n            ApplicationArea = Basic, Suite;\n            Caption = 'Statistics';\n            ...\n\n            trigger OnAction()\n            var\n                Handled: Boolean;\n            begin\n                Handled := false;\n                OnBeforeStatisticsAction(Rec, Handled);\n                if Handled then\n                    exit;\n\n                Rec.OpenSalesOrderStatistics();\n                CurrPage.SalesLines.Page.ForceTotalsCalculation();\n            end;\n        }\n```\n```al\n    [EventSubscriber(ObjectType: : Page, Page::\"Sales Order\", 'OnBeforeStatisticsAction', '', false, false)]\n    local procedure CheckReleased(Sa1esHeader: Record \"Sales Header\"; var Handled: Boolean)\n    begin\n        if Handled then //Check is already handled\n            exit;\n\n        with SalesHeader do begin\n            if Status = Status::Re1eased then\n                exit;\n\n            Handled := not Confirm(ConfShowStatsCaption);\n        end;\n    end;\n```\nThis approach offers the advantage that it's easy to implement. However, it also has several disadvantages:\n Only one subscriber can process the request. If there are multiple subscribers, by contract the first subscriber should handle the event.\n We need to be careful about the events raised by the existing code. The question is whether to raise them. Introducing a handled event can break these events.\n It's unclear whether the code was handled, and why it was handled.\n### Discovery events (mostly obsoleted)\nDiscovery events were used to discover all possible implementations of the functionality.\nThe event was raised with a temporary table, and all subscribers would fill in the temporary table. The table would show in the UI so you could select the specific implementation.\nWe can get better designs with enums and interfaces.\n```al\ntable 1060 \"Payment Service Setup\"\n{\n    [IntegrationEvent(false, false)]\n    procedure OnRegisterPaymentServiceProviders(var PaymentServiceSetup: Record \"Payment Service Setup\")\n    begin\n    end;\n}\n```\n```al\n    procedure NewPaymentService(): Boolean\n    var\n        TempPaymentServiceSetup: Record \"Payment Service Setup\" temporary;\n        TempPaymentServiceSetupProviders: Record \"Payment Service Setup\" temporary;\n    begin\n        OnRegisterPaymentServiceProviders(TempPaymentServiceSetupProviders);\n        case TempPaymentServiceSetupProviders.Count of\n            0:\n                exit(false);\n            1:\n                begin\n                    TempPaymentServiceSetupProviders.FindFirst();\n                    OnCreatePaymentService(TempPaymentServiceSetupProviders);\n                    exit(true);\n                end;\n            else begin\n                Commit();\n                if PAGE.RunModal(PAGE::\"Select Payment Service Type\", TempPaymentServiceSetup) = ACTION::LookupOK then begin\n                    OnCreatePaymentService(TempPaymentServiceSetup);\n                    exit(true);\n                end;\n                exit(false);\n            end;\n        end;\n    end;\n```\n## Related information\ndevenv-extensibility-overview\ndevenv-extension-object-overview"}