PageExtension trigger OnAfterValidate not fired
Describe the bug PageExtension trigger OnAfterValidate not fired
pageextension 50110 "Purch. Invoice Subform Ext" extends "Purch. Invoice Subform"
{
layout
{
addafter(Description)
{
field("Additional description"; "Additional description")
{
ApplicationArea = all;
Importance = Promoted;
Editable = IsEditable;
trigger OnValidate()
begin
if (Rec.Type <> Rec.Type::"G/L Account") then begin
"Additional description" := '';
end;
end;
}
}
modify(Type)
{
trigger OnAfterValidate();
begin
Message('Test00');
IF (xRec.Type <> Rec.Type) AND (Rec.Type = Rec.Type::"G/L Account") THEN
IsEditable := true
else
IsEditable := False;
CurrPage.Update(false);
end;
}
}
var
[InDataset]
IsEditable: boolean;
trigger OnAfterGetCurrRecord()
begin
if (xRec.Type <> Rec.Type) AND (Rec.Type = Rec.Type::"G/L Account") then
//if (Rec.Type = Rec.Type::"G/L Account") then
IsEditable := true
else
IsEditable := false;
CurrPage.Update(false);
end;
I should always click on previous line to get the right behavior!
Could you please provide the following versions:
- AL Language:
- Business Central:
AL Language: 21.109895 Business Central: CA Dynamics NAV 13.4 (28874)
I believe you can't use 'OnAfterValidate' as a normal trigger in PageExtension. You should simply use 'OnValidate', the 'OnAfterValidate' is used as event, so if you want to use the OnAfterValidate you should use it as an event subscriber
Thank you very much for your answer.
De : Frederik Goerlandt [email protected] Envoyé : vendredi 17 mai 2019 10:21 À : microsoft/AL Cc : sradouan; Author Objet : Re: [microsoft/AL] PageExtension trigger OnAfterValidate not fired (#4768)
I believe you can't use 'OnAfterValidate' as a normal trigger in PageExtension. You should simply use 'OnValidate', the 'OnAfterValidate' is used as event, so if you want to use the OnAfterValidate you should use it as an event subscriber
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/microsoft/AL/issues/4768?email_source=notifications&email_token=ABZOZTXY44WISC5IF7YRBHLPV2BL5A5CNFSM4HAKWPS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVUMANQ#issuecomment-493404214, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABZOZTXXJKLAWXG2RLI6YODPV2BL5ANCNFSM4HAKWPSQ.