web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

I can't loop over records of table "Page Action"

(1) ShareShare
ReportReport
Posted on by 145
 I'm writing a code in AL to insert all actions of all pages in the system in a table, BUT somehow there's a bug preventing me to loop over records of /Page Action/ table, In this code snippet I've just shown the name of the action but still running this procedure didn't show anything except just BC crash:
 
 
procedure populateActions()
    var
        PageAction: Record /Page Action/;
begin   
     PageAction.Reset();
    if PageAction.FindSet() then begin
        repeat begin
            Message(PageAction.Name);
        end until PageAction.Next() = 0;
    end;
end;
 
Can someone please suggest a solution or workaround for this problem? Thank you in advance!
  • Janarthananv Profile Picture
    115 on at
    Dear Members,
    I noticed that in the code you had written a line that uses "Message(PageAction.Name)". The code does not run in loop, if you use this. Instead, please use something as highlightened in the below code.
     
     
    procedure populateActions()
        var
            PageAction: Record /Page Action/;
    begin   
         PageAction.Reset();
        if PageAction.FindSet() then begin
            repeat begin
              //  Message(PageAction.Name);
         
         Rec."Document No." := PageAction."Document No."; 
            end until PageAction.Next() = 0;
        end;
    end;
     
    Thanks,
    Janarthanan v
  • El Mehdi Taher Profile Picture
    145 on at
    Even though I did what you said with the same issue the app crashed. Moreover, I have just looped over it without doing anything but the app still crashes, I don't know why?


    procedure populateActions()
        var
            PageAction: Record /Page Action/;
    begin   
         PageAction.Reset();
        if PageAction.FindSet() then begin
            repeat begin
                // Message(PageAction.Name);
            end until PageAction.Next() = 0;
        end;
    end;

  • El Mehdi Taher Profile Picture
    145 on at

    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;

    But the weird thing is if I loop just to 10 it works and shows me the actions!

    Any help is much appreciated!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 676 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 483 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 310 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans