Skip to main content

Notifications

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 549
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
  • Verified answer
    Hein Kruger Profile Picture
    549 on at
    Customer Statement different Report ID for some Customers
    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;
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    17,402 Super User 2025 Season 1 on at
    Customer Statement different Report ID for some Customers
    Zhu is correct, you can create new action to handle it.
  • Suggested answer
    YUN ZHU Profile Picture
    84,557 Super User 2025 Season 1 on at
    Customer Statement different Report ID for some Customers
    Hi, maybe you could add a new action to handle this. But this sounds like a Microsoft problem.
     
    Thanks
    ZHU
     

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,452

#2
YUN ZHU Profile Picture

YUN ZHU 1,313 Super User 2025 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 1,083 Most Valuable Professional

Featured topics

Product updates

Dynamics 365 release plans