microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
732 stars 243 forks source link

OnBeforeActionEvent subscriber is not executed when page action does not contain any logic on OnAction trigger #5908

Closed sidser closed 4 years ago

sidser commented 4 years ago

Describe the bug If some page action does not contain any logic on OnAction trigger then OnBeforeActionEvent is not triggered and corresponding subscribers are not executed.

To Reproduce Steps and to reproduce the behavior: 1.AL Code to reproduce the issue a) Create event subscriber and subscribe to OnBeforeActionEvent of the page action that has some logic on OnAction trigger. Put some logic in the created event subscriber.

For example, I created two OnBeforeActionEvent subscribers

codeunit 50000 "Test Subscriber" { [EventSubscriber(ObjectType::Page, Page::"Customer Card", 'OnBeforeActionEvent', 'NewSalesInvoice', true, true)] local procedure OnBeforeActionNewSalesInvoice() var ConfirmQst: Label 'Are you sure you want to execute this action?'; begin // Some code, for example If Confirm(ConfirmQst) then; // This code is not executed. NewSalesInvoice action does not have OnAction trigger but has RunObject = Page "Sales Invoice" end;

[EventSubscriber(ObjectType::Page, Page::"Customer Card", 'OnBeforeActionEvent', 'Contact', true, true)]
local procedure OnBeforeActionContact()
var
    ConfirmQst: Label 'Are you sure you want to execute this action?';
begin
    // Some code, for example
    If Confirm(ConfirmQst) then;  // This code is executed. Contact action has OnAction trigger.
end;

} b) Publish and Install your changes to Business Central c) Open "Customer Card" for any customer and

Expected behavior OnBeforeAction event has to be triggered for page actions that do not have OnAction trigger and corresponding subscribers have to be executed.

Screenshots

5. Versions:

atoader commented 4 years ago

Hi! Please take a minute to read the guidelines for this repository https://github.com/microsoft/AL and our collection of frequently asked questions https://github.com/Microsoft/AL/wiki/frequently-Asked-Questions .

As this repository is only for issues related to the AL compiler in latest developer preview environment for Dynamics 365 Business Central. We suggest that you open a support case or file a bug in Collaborate, to ensure that all Business Central users benefit from your catch as soon as possible.

To open a support case, you can:

If you file the bug in Collaborate, remember to include steps to reproduce the issue, and the Business Central build number and country version you're using.

miljance commented 4 years ago

I just hit the same limitation. I will file a bug on collaborate.