I tried another approach to populate each page separately then loop over its actions but went in vain and crashes it again
procedure populateActions(): Integer
var
PageControlFields: Record "Page Control Field";
PageAction: Record "Page Action";
pagesId: list of [Integer];
id: Integer;
begin
PageControlFields.Reset();
if PageControlFields.FindSet() then begin
repeat begin
pagesId.Add(PageControlFields.PageNo);
PageControlFields.SetFilter(PageNo, '<>%1', PageControlFields.PageNo);
end until PageControlFields.Next() = 0;
end;
//for id := 1 to 10 do begin //it works
for id := 1 to pagesId.Count do begin
PageAction.Reset();
PageAction.SetRange("Page ID", pagesId.Get(id));
if PageAction.FindSet() then begin
repeat begin
Message(PageAction.Name);
end until PageAction.Next() = 0;
end;
end;
end;