Skip to main content

Notifications

Announcements

No record found.

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

Passing Default Report parameter for sending the email in Business central

Posted on by 281

Dear members,

I would like to know how to pass the parameters for a default value while sending a email with attachment (Report) in business central. Currently, my email sending process gets failed when I am trying to send the email.

Please do suggest me the best way to pass the parameters for a default value.

Thanks in advance,

  • Suggested answer
    NAV_with_Narang Profile Picture
    NAV_with_Narang 2,236 Super User 2024 Season 1 on at
    RE: Passing Default Report parameter for sending the email in Business central

    There are a couple of ways you can do that, Passing values through functions, passing values through SETTABLEVIEW if these values are table fields or can also pass values through a XML Formatted string in the request page

    Scenario 1

    If your report filters are all table fields, suggest you to use the below in your code

    SETRANGE

    SETRANGE

    REPORT.SETTABLEVIEW

    REPORT.RUN

    Scenario 2

    If the report request page parameters are variables instead of table fields, Create a global function on the report you'd like to be attached as PDF in the Email. Make sure this function has all the request page global variables on the left side of the assignment and all your function parameters on the right side, much like:

    pastedimage1685015848966v1.png

    Now from the email batch report you have created, which attaches the above report as PDF, you can write the code as:

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 Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans