Hi,
We have a report with a request page with 6 boolean parameters.
So when called manually for print/preview we can set these parameters.
We also use the same report to send as e-mail. So with an e-mail button we call the report with SAVEASPDF and present the pdf in an e-mail dialog (based on the sales order confirmation e-mail of NAV 2015). In case we use the SAVEASPDF for e-mail we want 3 of the 6 boolean parameters to be checked which we would normally set on the request page.
When I do the e-mail action, the SAVEASPDF uses the parameter values as how they were set the last time when printing manually and not specifically those 3 I want by default (the SaveValues parameter on the request page is Yes)
I tried to handle this with the GUIALLOWED, but GUIALLOWED is True when using SAVEASPDF.
IF NOT GUIALLOWED THEN
SetDefaults;
Also tried with USEREQUESTPAGE, but also here USEREQUESTPAGE is True (which is weird because when using SAVEASPDF the requestpage is not shown.
IF NOT CurrReport.USEREQUESTPAGE THEN
SetDefaults;
I could do it by calling a function on the report before doing SAVEASPDF but then I would need to declare my report as a variable.
But I don't want that as my e-mail function is a generic one which we use for different reports so it is called as REPORT.SAVEASPDF(Number, FileName, Record);
Is there any way to check in a report how it has been called so that we now that it is run as SAVEASPDF (without request page)?
Comments
1. Find a way to actually save your parameters somewhere to use - the Job Queue Entry table gives an example of this
2. Put in some extra code to convert the output stream to a file.
It doesn't look like there's a way (at least in my 2015 Cumulative Update 1 database) to tell if the report is being run as "SAVEASPDF/SAVEASEXCEL" if the NOT GUIALLOWED call doesn't work.
You set the internal variables for the report inside this function.
You then call this function before running the report.
The report needs to be a variable in the calling code.
You set the internal variables for the report inside this function.
You then call this function before running the report.
The report needs to be a variable in the calling code.
It's an old post but...
In which trigger did you use this:
IF NOT CurrReport.USEREQUESTPAGE THEN
SetDefaults;