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

Add action to list page to print custom report

(0) ShareShare
ReportReport
Posted on by 1,165

Hi All,

I have created an action on Posted sales invoice to print a different format than than default and its working as below:

            action("Print Packing Slip")

            {

                Promoted = true;

                PromotedCategory = Process;

                Caption = 'Print Packing Slip';

                Ellipsis = true;

                Image = Print;

                PromotedIsBig = true;

                ApplicationArea = All;

                ToolTip = 'Print Packing Slip Based On Invoice';

                //Visible = NOT IsOfficeAddin;

                trigger OnAction()

                var

                    SalesRec: Record "Sales Invoice Header";

                    Myreport: Report MyPostedInvPackingSlip;

                begin

                    ;

                    Clear(SalesRec);

                    SalesRec := rec;

                    SalesRec.SetRecFilter;

                    Myreport.SetTableView(SalesRec);

                    Myreport.RunModal();

                end;

            }

Now I want to do the same from posted invoice list page.  Not sure ho to select a record and change print layout on a list page

thanks

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    I am not sure what exactly do you mean by "How to select a record".

    we can select a line in list page also and actions will be performed on that record/line.

  • Suggested answer
    JAngle Profile Picture
    157 on at

    Take this as an example:

    action(Print)

               {

                   ApplicationArea = Basic, Suite;

                   Caption = '&Print';

                   Ellipsis = true;

                   Image = Print;

                   Promoted = true;

                   PromotedCategory = Category7;

                   ToolTip = 'Prepare to print the document. A report request window for the document opens where you can specify what to include on the print-out.';

                   Visible = NOT IsOfficeAddin;

                   trigger OnAction()

                   var

                       SalesInvHeader: Record "Sales Invoice Header";

                   begin

                       SalesInvHeader := Rec;

                       CurrPage.SetSelectionFilter(SalesInvHeader);

                       SalesInvHeader.PrintRecords(true);

                   end;

               }

    Just replace the last line with a line for your desired report like:

    var

       CustomerRec: Record Customer;

       SomeReport: Report "Salesperson - Sales Statistics";

    begin

       SomeReport.SETTABLEVIEW(CustomerRec);  

       SomeReport.RUN;

    end;

    Layout will be whatever is set in the report layout selection table

  • Anita75 Profile Picture
    1,165 on at

    Close but the selected report number didn't come through so chnage it slightly

                   begin

                       SalesInvHeader := Rec;

                       CurrPage.SetSelectionFilter(SalesInvHeader);

                       MYReport.Run();

                       ;

                   end;

  • Anita75 Profile Picture
    1,165 on at

    Actually this code didn't work ...selected row invoice number is not passing to request page

  • Verified answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    you have to use SetSelectionFilter.

  • Anita75 Profile Picture
    1,165 on at

    Code worked I was overthinking...

                       SalesInvHeader := Rec;

                       CurrPage.SetSelectionFilter(SalesInvHeader);

                       MyReport.SETTABLEVIEW(SalesInvHeader);

                       MYReport.Run;

    But the limitation is it only works when selecting one row on the list page..Is there a way to get this work when selecting mutiple rows?

  • BchM Profile Picture
    92 on at

    Hi, did you find any way to do it with multiple rows?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,995 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,147 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 893

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans