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
728 stars 241 forks source link

Sequence of Triggers needs to be revised for reliable extension behavior #5838

Closed Rama-M closed 4 years ago

Rama-M commented 4 years ago

Tests has indicated the Page level trigger is running in correct sequence. The correct sequence of Validation Trigger should be as follows from the first one to last one as follows.

1) Page - OnBeforeValidate Trigger 2) Table - OnValidate Trigger 3) Page - OnAfterValidate Trigger 4) Page - OnModifyRecord/OnInsertRecord Trigger 5) Table - OnModify/OnInsert Trigger

Can this order be implemented so that we can reliably use these triggers in logically. It will also really useful to add additional parameter to the event subscription such as "Skip Trigger" as VAR. Once "Skip Trigger" is set to TRUE in the event subscription function, system will not run any further trigger of it's kind.

For example if "Skip Trigger" is set to TRUE in Page - OnBeforeValidate Trigger, Table - OnValidate Trigger and Page - OnAfterValidate Trigger will not run, but page and table level Modify/Insert trigger will run. But the value needs to be set without running the trigger.

If "Skip Trigger" is set to TRUE in OnModifyRecord/OnInsertRecord Trigger in Page any of the existing OnModifyRecord/OnInsertRecord Trigger in page as well as OnModify/OnInsert Trigger in Table will not run. But record needs to be inserted/modified without running the trigger.

If "Skip Trigger" is set to TRUE in OnModify/OnInsert Trigger in Table is set to True any of the existing OnModify/OnInsert Trigger in Table will not run. But record needs to be inserted or modified without running the trigger.

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.