Hi,
I wanted to add a new field Status RPE in Purchase header Table and update this field when Release and Reopen actions are clicked.
So used code In AL
I could write for Reopen Action but not for Release . May I knoe how to solve this.
Thanks
Ruvini.
*This post is locked for comments
OnAfterGetRecord( ) and OnModifyRecord( ) Wright on below code
IF REC.Status = Status::Released then Begin
IF PurchaseOrderRec.GET("Document Type", "No.") Then Begin
PurchaseOrderRec."Status RPE":= true;
PurchaseOrderRec.MODIFY;
END;
END ELSE Begin
IF PurchaseOrderRec.GET("Document Type", "No.") Then Begin
PurchaseOrderRec."Status RPE":= False;
PurchaseOrderRec.MODIFY;
END;
END;
(or)
Wright code in Release and Reopen button.
Why you write a code in the OnAfterAction event? It's not so good writing a code in a page extension.
My suggestion is to subscribe the OnAfterValidate event of the Status field and then here write your code by checking the status:
if Status = Status::Released then
//...
else
//...
Can you tell me how to do
what I try is this
actions
{
modify(Reopen)
{
trigger OnAfterAction();
begin
PurchaseOrderRec.GET("Document Type", "No.");
PurchaseOrderRec."Status RPE":= true;
PurchaseOrderRec.MODIFY;
end;
}
modify(Release)
{
trigger OnAfterAction();
begin
PurchaseOrderRec.GET("Document Type", "No.");
PurchaseOrderRec."Status RPE":= false;
PurchaseOrderRec.MODIFY;
end;
}
}
But cannot use Release.Reopen works fine
My code is
actions
{
modify(Reopen)
{
trigger OnAfterAction();
begin
PurchaseOrderRec.GET("Document Type", "No.");
PurchaseOrderRec."Status RPE":= true;
PurchaseOrderRec.MODIFY;
end;
}
modify(Release)
{
trigger OnAfterAction();
begin
PurchaseOrderRec.GET("Document Type", "No.");
PurchaseOrderRec."Status RPE":= false;
PurchaseOrderRec.MODIFY;
end;
}
}
I cannot see your code (image is broken?) but you can create an event subscriber to the OnAfterValidate of the Purchase Header's Status field and act accordingly.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156