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

Notifications

Announcements

No record found.

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 111
 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!
I have the same question (0)
  • Janarthananv Profile Picture
    91 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
    111 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
    111 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans