web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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 481

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

I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    95,548 Super User 2025 Season 2 on at

    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

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    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;

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,151

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,443 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,092 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans