Set default parameters when using SAVEASPDF
fgoerlandt
Member Posts: 12
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.
Also tried with USEREQUESTPAGE, but also here USEREQUESTPAGE is True (which is weird because when using SAVEASPDF the requestpage is not shown.
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)?
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)?
Frederik Goerlandt
Consultant
B-Con Solutions - Waregem - Belgium
Consultant
B-Con Solutions - Waregem - Belgium
0
Comments
-
I haven't used it yet, but the new "SAVEAS" function might do the job. Have a look at Codeunit 449 and see how it uses it there. Your challenges will be to:
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.0 -
Hi,
It's an old post but...
In which trigger did you use this:
IF NOT CurrReport.USEREQUESTPAGE THEN
SetDefaults;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 329 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions