Rec.Modify on AfterGetRecord trigger in a page

Hi All, I am confused about the coding on the OnAfterGetRecord Trigger with the modification of the rec table.

First I wrote a function called CopyQtyFromContainer on a page, Then Call that function on the ‘onAfterGetRecord’ Trigger, But I got such error :You can not make any changes in the table until a transaction has been started .

Below are my code of the function CopyQtyFromContainer

ContainerItem.SETRANGE(Type,ContainerItem.Type::“Purchase Order”);
ContainerItem.SETRANGE(“Document No.”,“Document No.”);
ContainerItem.SETRANGE(“Item No.”,“No.”);

IF ContainerItem.FINDSET THEN BEGIN
VALIDATE(Quantity,ContainerItem.Quantity);
CurrPage.UPDATE(TRUE);
// Rec.Modify(true); It is no work neither for this code.
END;

Anyone whoelse can explain this for me?

Any suggestion will be appreciated. Thanks in advance.