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:
Now from the email batch report you have created, which attaches the above report as PDF, you can write the code as: