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...
Answered

Assistance adding actions to page

(0) ShareShare
ReportReport
Posted on by 13
Hello Community,
 
I am working on a custom page where I would like to add actions. I cannot get the code to compile. I get AL0198 among other errors. I have provided the code for the page as well as another example page where I got actions working. Any assistance is appreciated. 
 
page 62802 OpenPoTableJobItem
{
    Caption = 'Open PO Report (Job)(Item)';
    PageType = List;
    UsageCategory = Lists;
    ApplicationArea = All;
    SourceTable = OpenPoTableJobItem;
    Editable = false;
    SaveValues = false;
    SourceTableView = sorting(/Expected Receipt Date/, /No./, INXPOLine);
 
    layout
    {
        area(Content)
        {
            repeater(Group)
            {
                field(RowNo; Rec.RowNo)
                {
                    ApplicationArea = All;
                }
                field(/Purchase Order/; Rec./No./)
                {
                    ApplicationArea = All;
                }
                field(INXPOLine; Rec.INXPOLine)
                {
                    ApplicationArea = All;
                }
                field(/Job No./; Rec./Job No./)
                {
                    ApplicationArea = All;
                }
                field(Quantity; Rec.Quantity)
                {
                    ApplicationArea = All;
                    Caption = 'QTY Ordered';
                    DecimalPlaces = 0;
                }
                field(/Quantity Received/; Rec./Quantity Received/)
                {
                    ApplicationArea = All;
                    Caption = 'QTY Received';
                    DecimalPlaces = 0;
                }
                field(/No./; Rec./TypeNo./)
                {
                    ApplicationArea = All;
                }
                field(Description; Rec.Description)
                {
                    ApplicationArea = All;
                }
                field(/Promised Receipt Date/; Rec./Promised Receipt Date/)
                {
                    ApplicationArea = All;
                }
                field(/Expected Receipt Date/; Rec./Expected Receipt Date/)
                {
                    ApplicationArea = All;
                    StyleExpr = StyleExprTxt;
                }
                field(/Buy-from Vendor Name/; Rec./Buy-from Vendor Name/)
                {
                    ApplicationArea = All;
                }
                field(Name; Rec.Name)
                {
                    ApplicationArea = All;
                }
                field(inxPOrec; Rec./inxPOrec/)
                {
                    ApplicationArea = All;
                }
                field(INXComment; Rec.INXComment)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
 
    trigger OnOpenPage()
    var
        PurchaseOrderQuery: Query /openPoQueryA/;
    begin
        if PurchaseOrderQuery.Open() then begin
            while PurchaseOrderQuery.Read() do begin
                Rec.Init();
                Rec.RowNo := Rec.RowNo + 1;
                Rec./No./ := PurchaseOrderQuery.PHponumber;
                Rec.INXPOLine := PurchaseOrderQuery.PLlinenumber;
                Rec./Buy-from Vendor Name/ := PurchaseOrderQuery.PHvendor;
                Rec.Description := PurchaseOrderQuery.PLlinedesc;
                Rec.INXComment := PurchaseOrderQuery.PLcomment;
                Rec.inxPOrec := PurchaseOrderQuery.PLdelivered;
                Rec./Promised Receipt Date/ := PurchaseOrderQuery.PLpromiseddate;
                Rec./Expected Receipt Date/ := PurchaseOrderQuery.PLexpecteddate;
                Rec./Job No./ := PurchaseOrderQuery.PLjobno;
                Rec./TypeNo./ := PurchaseOrderQuery.PLTypeno;
                Rec.Quantity := PurchaseOrderQuery.PLqtyordered;
                Rec./Quantity Received/ := PurchaseOrderQuery.PLqtyreceived;
                Rec.Name := PurchaseOrderQuery.REbuyer;
                Rec.Insert();
            end;
            PurchaseOrderQuery.Close();
            rec.FindFirst()
        end;
    end;
 
    trigger OnAfterGetRecord()
    begin
        If Rec./Expected Receipt Date/ < WorkDate() then
            StyleExprTxt := 'Unfavorable'
        else
            If Rec./Expected Receipt Date/ > WorkDate() then
                StyleExprTxt := 'Favorable'
            else
                StyleExprTxt := 'None'
    end;
 
    var
        StyleExprTxt: Text;
}
 
 
page 62805 PageName
{
    PageType = List;
 
    actions
    {
        // Adds the action called /My Actions/ to the Action menu
        area(Processing)
        {
            action(/Nonjob (active)/)
            {
                Promoted = true;
                PromotedCategory = Process;
                ApplicationArea = All;
                RunObject = page 62802;
                Image = SelectReport;
            }
        }
    }
}
I have the same question (0)
  • Verified answer
    Mohana Yadav Profile Picture
    61,005 Super User 2025 Season 2 on at
    Can you paste the error text as well?
    It should contain the Line and Column details.
  • jack Profile Picture
    13 on at
    Mohana,
     
    Thanks for your response. I determined the resolution was to place the code in the layout section. This is resolved.

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 2,238

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 630

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans