Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Answered

Filter a report Based on Open Record

(0) ShareShare
ReportReport
Posted on by 171

Greetings to all of you!

My case is the one that i will explain briefly below:

I have already created a custom report for quote confirmations in a customer of mine.

The request page is the one below:

pastedimage1679669089482v1.png

As you can see here, i have the field QuoteNo, which has a table relation with sales header and allows the user to select one of the available quotes and then print the report.

What i need , is : 

Since the action button for the run of this report, is within the sales quote page , i would like to be able to pre-filter the report with the actual record that the user is in at this exact moment.

For example if the user has openned the sales quote page for the document PRF-000013, then , if QuoteNo is empty, the report must be printed for the PRF-00013, the record that the user sees in his UI.

This is standard in almost all the reports related to sales-purchases in business central , for example if i dont fill anyting in the request page of the Order Confirmation report, the system, somehow, will print to me the order confirmation only for the order that i am checking in my UI. I havent figured out from the source code,how this is possible to be done , thats why i need your help!!

Thank you all in advance for your help.

With respect,

Antonis

  • AntonisK Profile Picture
    AntonisK 171 on at
    RE: Filter a report Based on Open Record

    Perfect Sir

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Filter a report Based on Open Record

    Use a trigger like this one:

    trigger OnAction()

                       var

                           SalesHeader: Record "Sales Header";

    SomeReport: Report YourReport;

                       begin

                           SalesHeader := Rec;

                           SalesHeader.SetRecFilter();

                         SomeReport.SetTableView(SalesHeader);  

                         SomeReport.Run;

                           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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans