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.
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.
My code is
actions
{
modify(Reopen)
trigger OnAfterAction();
begin
PurchaseOrderRec.GET("Document Type", "No.");
PurchaseOrderRec."Status RPE":= true;
PurchaseOrderRec.MODIFY;
end;
}
modify(Release)
PurchaseOrderRec."Status RPE":= false;
Can you tell me how to do
what I try is this
But cannot use Release.Reopen works fine
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
OnAfterGetRecord( ) and OnModifyRecord( ) Wright on below code
IF REC.Status = Status::Released then Begin
IF PurchaseOrderRec.GET("Document Type", "No.") Then Begin
END;
END ELSE Begin
PurchaseOrderRec."Status RPE":= False;
(or)
Wright code in Release and Reopen button.
Business Applications communities