5
It is important to have a feature in all the Trigger Type events (OnBefore) Such as
OnBeforeInsert,OnBeforeModify,OnBeforeDelete,OnBeforeRename,OnBeforeValidate to have an extra parameter such as 'SkipTrigger'. Once this is set to true any subsequent execution of the trigger needs to be supressed for all the extensions. Also the execution code needs to be prioritised as follows (from high priority to low priority).
1.Any event Subscription in Codeunit 50000 to 99999 (ie 50000 taking higher priority compared to 99999)
2.Any event Subscription in Codeunit 100000 and above
3.Any event Subscription in Codeunit up to 49999

This will allow solution centre to perform a possible code cloning and override the standard trigger code in an extension to accommodate any customisation for the customer in a custom extension. This will introduce "Code layering concept" - Similar to the old Menu object where one can remove a standard menu using their own menu design change.

Further All the 'OnAfter' trigger such as OnAfterInsert,OnAfterModify,OnAfterDelete,OnAfterRename,OnAfterValidate needs to be executed in the following order (from high priority to low priority) as well. This will give a quite easy to follow and strict order of execution when the same event is subscribed by multiple extensions.
1.Existing code in the trigger code
2.Any event Subscription in Codeunit up to 49999
3.Any event Subscription in Codeunit 100000 and above
4.Any event Subscription in Codeunit 50000 to 99999 (ie 99999 taking higher priority compared to 50000)

See below for code example

[EventSubscriber(ObjectType::Table, Database::"Sales Line", 'OnBeforeValidateEvent', 'Status', true, true)]
LOCAL PROCEDURE OnBeforeValidateOfType(VAR Rec: Record "Sales Line"; VAR xRec: Record "Sales Line"; CurrFieldNo: Integer;SkipTrigger: Boolean);
BEGIN
//Your Over ridden code
SkipTrigger := True;

END;
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future.

Best regards,
Business Central Team

Comments

R

Can you please prioritise this change in the next major release in 2020, so that we can start working on real life customer upgrades which will require this feature.

Category: Development