Use NAS to generate PDF Then attach to an Email
ForeverBlue
Member Posts: 54
Hi,
I have create the codeunit to use Bullzip PDF to generate PDF. The function working great, but when I put it in the Job Queue then there is an error message,"You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic."
I have disable any dialog in the report.
In the codeunit, I believed I disable popup window for Bullzip.
Thanks
I have create the codeunit to use Bullzip PDF to generate PDF. The function working great, but when I put it in the Job Queue then there is an error message,"You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic."
I have disable any dialog in the report.
In the codeunit, I believed I disable popup window for Bullzip.
BullZipPDF.Init;
BullZipPDF.LoadSettings;
BullZipPDF.SetValue('OutPut', PDFFilePath + PDFFileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowSaveAS', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
REPORT.RUNMODAL(50007, FALSE, FALSE);
Did I miss anything??Thanks
0
Comments
-
This code-extract looks fine to me, but as you didn't publish all code, we can only guess why it gives you that error.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
sorry about that.. This is my codeunit
IF ISCLEAR(BullZipPDF) THEN CREATE(BullZipPDF); PDFFilePath := 'E:\Flash\'; PDFFileName := 'FlashReport_'+FORMAT(DATE2DMY(TODAY,2))+'_' +FORMAT(DATE2DMY(TODAY,1))+'_'+FORMAT(DATE2DMY(TODAY,3)) + '.pdf'; BullZipPDF.Init; BullZipPDF.LoadSettings; BullZipPDF.SetValue('OutPut', PDFFilePath + PDFFileName); BullZipPDF.SetValue('Showsettings', 'never'); BullZipPDF.SetValue('ShowSaveAS', 'never'); BullZipPDF.SetValue('ShowPDF', 'no'); BullZipPDF.SetValue('ShowProgress', 'no'); BullZipPDF.SetValue('ShowProgressFinished', 'no'); BullZipPDF.SetValue('SuppressErrors', 'yes'); BullZipPDF.SetValue('ConfirmOverwrite', 'no'); BullZipPDF.WriteSettings(TRUE); REPORT.RUNMODAL(50007, FALSE, FALSE); IsDone := FALSE; I := 0; REPEAT IF FILE.EXISTS(PDFFilePath+PDFFileName) THEN BEGIN IF testFile.OPEN(PDFFilePath+PDFFileName) THEN BEGIN IsDone := TRUE; END; END; I += 1; SLEEP(1000); UNTIL (I > 60) OR IsDone; IF IsDone THEN BEGIN SenderName := 'Navision'; SenderAddress := 'support@something.com'; SendTO := 'someone@something.com'; Subject := 'Report.'; Email.CreateMessage(SenderName, SenderAddress, SendTO, Subject, 'This is an automatic generated email from Navision. Please do not reply.', FALSE); Email.AddAttachment(PDFFilePath+PDFFileName); Email.Send; END;0 -
My guess is that the report is bringing up the "Searching for record..." dialog box because the wrong key is used.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Hi, is your variable TestFile set to DataType of Dialog? If so, that's probably where you are getting tripped up0
-
my testFile is File Datatypejspopp wrote:Hi, is your variable TestFile set to DataType of Dialog? If so, that's probably where you are getting tripped up0 -
Name DataType Subtype Length PDFFilePath Text 250 PDFFileName Text 250 DefaultPrinter Text 100 TempDir Text 100 FlashReport Report Flash Report IsDone Boolean I Integer testFile File SendTO Text 1000 Email Codeunit SMTP Mail SenderName Text 100 SenderAddress Text 1024 Subject Code 50 BullZipPDF Automation 'Bullzip'.PDFPrinterSettings
0 -
When I run the Codeunit via Object designer this window pop up
0 -
Try commenting these lines out (or removing it from your code) and then run the NAS. See if that fixes the issue0
-
jspopp wrote:Try commenting these lines out (or removing it from your code) and then run the NAS. See if that fixes the issue
I comment out
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowSaveAS', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);
still no luck...
I think it's the print progress windows (the screenshot above), but i don't know how to disable that. The ShowProgress and showProgressFinished are already set to no.0 -
Try commenting this line out:
IF testFile.OPEN(PDFFilePath+PDFFileName) THEN BEGIN0 -
If I comment everything out, still have the same error.... ](*,)
Wait after I compile the Codeunit, do I have to restart NAS??0 -
Yes, restart the NAS and then see what happens after that0
-
After restart the NAS during down time, I don't have the error anymore :thumbsup: .
But even in the job Queue Log Entries shows Success, there is not time stamp in the End Date/Time and no PDF was generated and no email send... ](*,) The status of record in Job Queue Entries stays in In Process... AND I can't stop the NAS0 -
So the problem solved, it's very simple and stupid... :oops:
I login the server as the user account use by the NAS service then set the BullzipPDF printer as the default printer. Problem solved...0
Categories
- All Categories
- 75 General
- 75 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
