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

Customer Statement different Report ID for some Customers

(1) ShareShare
ReportReport
Posted on by 666
Hi, 
We have 10 customers that works with a different Customer Statement report than the rest of the Customers. 
The Default on Report Selection Sales is 50116 with built in layout.


On the Special Customers we added Report 50103 on the Customer Document Layouts:


When I run the Customer Statement from the Customer Card, I get the Report Request page for ID 50116 (The Default Report) and not Report ID 50103:
I Know the Statement shows a dummy request page before printing the report. 
I checked the code and found the issue is in :
codeunit 8800 "Custom Layout Reporting" -- local procedure GetRequestParameters()
The Procedure goes directly into Report Selections instead of checking "Custom Report Selection" for a different Report ID for this specific customer. 

Would it be possible to add an Eventsubscriber here so that we can change the report ID. 
Or is there another work around for this?

thanks
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    100,998 Super User 2026 Season 1 on at
    Hi, maybe you could add a new action to handle this. But this sounds like a Microsoft problem.
     
    Thanks
    ZHU
     
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    22,424 Super User 2026 Season 1 on at
    Zhu is correct, you can create new action to handle it.
  • Verified answer
    Hein Kruger Profile Picture
    666 on at
    I resolved it by making use of the OnBeforeAction and OnAfterAction of the standard "Report Statement" Action. 

    OnBefore:
    Check the related customer "Custom Report Selection" and see if there is an ID assigned to the Customer Statement. 
    Then we check the "Report Selections" to see what ID is assigned to Customer Statement. 
    If the two are not the same then assign the "Custom Report Selection" Report ID to the "Report Statement" Report ID. In my case there are no Email Body changes or Custom Layouts that needs to be assigned. 

    After the report has been run we reassign the old Report ID back to "Custom Report Selection". 
    Its not good standard, but it does resolve my issue. 
     
       trigger OnBeforeAction()
                var
                    ReportSelections: Record "Report Selections";
                    CustomReportSelection: Record "Custom Report Selection";
                begin
                    Clear(ReportID);
                    CustomReportSelection.Reset();
                    CustomReportSelection.SetRange("Source Type", DATABASE::Customer);
                    CustomReportSelection.SetRange("Source No.", Rec."No.");
                    CustomReportSelection.SetRange(Usage, CustomReportSelection.Usage::"C.Statement");
                    if CustomReportSelection.FindFirst() then begin
                        ReportSelections.Reset();
                        ReportSelections.SetRange(Usage, ReportSelections.Usage::"C.Statement");
                        ReportSelections.SetRange(Sequence, '1');
                        ReportSelections.SetFilter("Report ID", '<>0');
                        if ReportSelections.FindFirst() then
                            if CustomReportSelection."Report ID" <> ReportSelections."Report ID" then begin
                                ReportID := ReportSelections."Report ID";
                                ReportSelections.Validate("Report ID", CustomReportSelection."Report ID");
                                ReportSelections.Modify(true);
                            end;
                    end;
                end;
     
                trigger OnAfterAction()
                var
                    ReportSelections: Record "Report Selections";
                begin
                    if ReportID <> 0 then begin
                        ReportSelections.Reset();
                        ReportSelections.SetRange(Usage, ReportSelections.Usage::"C.Statement");
                        ReportSelections.SetFilter("Report ID", '<>0');
                        ReportSelections.SetRange(Sequence, '1');
                        if ReportSelections.FindFirst() then begin
                            ReportSelections.Validate("Report ID", ReportID);
                            ReportSelections.Modify(true);
                        end;
                    end;
                end;

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 2,002 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,255 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,217

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans