Al: Add OnBefore/After- Lookup, Drilldown, NewRecord event support for page extensions

Created on 31 Jul 2018  路  7Comments  路  Source: microsoft/AL

image

In case the image above doesn't load here's the code snippet:

pageextension 60089 "TRG General Journal" extends "General Journal"
{
layout
{
modify(CurrentJnlBatchName)
{
trigger OnLookup();
begin
OnSetBatchReversalDateEvent(Rec,ReversalDate);
end;

            trigger OnValidate();
            begin
                OnSetBatchReversalDateEvent(Rec,ReversalDate); 
            end;
        }
        modify(Amount)
        {
            trigger OnValidate();
            begin
                SAVERECORD(); 
            end;
        }
  }

}

Error Message: OnLookup is not a valid trigger/ OnValidate is not a valid trigger.
Is there a way to add code/functions/publishers to the page triggers of the native fields?

al-extensibility enhancement

Most helpful comment

Possibility of handle OnLookup event is a need. There are tons of customization here (opening custom lookup pages, applying filters and so on).

All 7 comments

Currently you can only add code before or after the OnValidate trigger by using OnAfterValidate and OnBeforeValidate triggers:

modify("Cause Of Absence Filter") 
{
            trigger OnAfterValidate() 
            begin
            end;
}

You can always see the available triggers by pressing Ctrl + Space (IntelliSense) after the trigger keyword.

Will access to those field triggers be added at some point though? I need to put code on Lookup, Drilldown, OnNewRecord and other native page and page triggers that aren't available now.

@Anna-Gudimova OnNewRecordEvent does exist, like here on Purchase Prices page:
OnNewRecordEvent(VAR Rec : Record "Purchase Price"; BelowxRec : Boolean; VAR xRec : Record "Purchase Price")
But OnlookUp publishers doesn't exist yet ...
And we need them too (from table/page).

Possibility of handle OnLookup event is a need. There are tons of customization here (opening custom lookup pages, applying filters and so on).

hi Stanislaw, what's the status on any generic native OnValidate/OnBeforeValidate/OnAfterValidate events for pages and tables? This would save you a lot of new in-code-events you are currently creating for my colleagues ;)

Table Event Publisher
image

Page Event Publisher
image

PageExtension Modification
image

Any news on this?

any update on the issue?

Was this page helpful?
0 / 5 - 0 ratings