Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

How to get current record associated with Report?

(0) ShareShare
ReportReport
Posted on by 479

I want to pass the current record of a report into a codeunit, but I whenever I try passing 'Rec' to a procedure in the codeunit I get this error: The name 'Rec' does not exist in the current context

My code right now (Report extension for Vendor Trial Balance report):

pastedimage1656966335983v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,546 Moderator on at
    RE: How to get current record associated with Report?

    Hi jdrco ,

    try this one.

     modify(vendor)

           {

               trigger OnAfterAfterGetRecord()

               var

                   AutomatedReportEmail: Codeunit AutomatedReportEmail;

               begin

                   if recvendor.get(Vendor."No.") then

                       AutomatedReportEmail.ReportSendmail(RecVendor);

               end;

           }

       }

       var

           RecVendor: Record vendor;

  • Suggested answer
    YUN ZHU Profile Picture
    83,072 Super User 2025 Season 1 on at
    RE: How to get current record associated with Report?

    Hi, Rec cannot be used in ReportExtension. This is different from Page and Table. If you want to use Vendor table, you need to declare a variable.

    pastedimage1656980656322v1.png

    Hope this helps.

    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

Announcing the Engage with the Community forum!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 858

#2
YUN ZHU Profile Picture

YUN ZHU 773 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 569

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans