I am trying to replace report2 with report1 on this event. Any help with syntax would be much appreciated.
Thanks.
I am trying to replace report2 with report1 on this event. Any help with syntax would be much appreciated.
Thanks.
Hi, you can find the code of Customer Layout in Custom Report Layouts page. But this field is not displayed on the page, you can view it through Page inspection, or open the table directly.
For example,
Hope this helps as well.
Thanks.
ZHU
Hi Mr.Zhu,
Thank you.That was extremely kind of you to test the functionality. I am still having the same error. How do I find the exact code of a report. I think it's the code that is wrong at setTempLayoutSelected.
Apologies for the trouble caused.
Hi, I just tested the false case, and there is no error. I think we need to check again if the Code of the Report layout is correct, and if it can be printed properly on the BC.
pageextension 50105 SalesOrderListExt extends "Purchase Order List" { actions { addafter(Post) { action(PrintSelectedLayout) { Caption = 'Print Selected Layout'; Ellipsis = true; Image = Print; Promoted = true; PromotedCategory = Category8; ApplicationArea = All; trigger OnAction() var ReportLayoutSelection: Record "Report Layout Selection"; PurchHeader: Record "Purchase Header"; ZYLayouts: Label 'ZY Test Layout 01,ZY Test Layout 02'; Selection: Integer; begin PurchHeader.Reset(); CurrPage.SetSelectionFilter(PurchHeader); Selection := StrMenu(ZYLayouts); case Selection of 1: ReportLayoutSelection.SetTempLayoutSelected('MS-1322-EMAIL_DEF'); 2: ReportLayoutSelection.SetTempLayoutSelected('1322-000001'); else exit; end; Report.Run(Report::"Standard Purchase - Order", false, true, PurchHeader); end; } } } }
Hope this helps.
Thanks.
ZHU
Hey Mr.Zhu ,
I am getting this error
Report L:ayouts:
Custom Report Layout Selection
and my code
Mr.Zhu. Please keep the good work and blogs coming. This was a life saver
Hi, try the following.
Select a report layout before printing:
And in BC 21, Business Central 2022 wave 2 (BC21) new features: Choose the report layout on request page (Select a report layout before printing)
Hope this helps.
Thanks.
ZHU
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156