Announcements
Dear Sir,
I'm facing a problem with the DotNet variable in NAS Environment (NAV 2016). I have declared all the DotNet variables in a Codeunit to convert the WORDLAYOUT of a Report output into a HTML file. After that the Codeunit send the same HTML file in a email body.
It's working fine when I execute the Codeunit manually. It creates WORD file, converts it into HTML and then send the same HTML in the body of the email. During manual execution I have to declare all the DotNet variable as RunOnClient YES.
And in NAS Environment I have declared the same DotNet variables as RunOnClient No .
The piece of the Custom Code is as follows....
WordApplication :=WordApplication.ApplicationClass; WordDocument :=WordHelper.CallOpen(WordApplication,FileName,FALSE,TRUE); FileName2 := TEMPORARYPATH + DELCHR(FORMAT(CURRENTDATETIME),'=','\/:*?"<>| '); WordHelper.CallSaveAsFormat(WordDocument,FileName2,WordSaveFormat.wdFormatHTML);
The NAS has found null value in the first parameter of "CallSaveAsFormat" function and hence it gives the following error message.
Microsoft Dynamics NAV A call to Microsoft.Dynamics.Nav.Integration.Office.Word.WordHelper.CallSaveAsFormat failed with this message: Value cannot be null. Parameter name: document OK
I can't find the reason why it is doing so in NAS. If you have any idea about the same please reply.
Thank you,
Subrata Bauri
*This post is locked for comments
Amazing! It works. But why? And how did you find this?
I know you won't believe it... but I had exactly the same issue and I fixed creating a folder.
Just create a new "Desktop" directory inside of "C:\Windows\SysWOW64\config\systemprofile\"
I was about to get crazy.
Will NAS be able to execute the following C/AL code on NAV 2016 ?
WordApplication :=WordApplication.ApplicationClass; WordDocument :=WordHelper.CallOpen(WordApplication,FileName,FALSE,FALSE);
I have found the same error message....
Microsoft Dynamics NAV A call to Microsoft.Dynamics.Nav.Integration.Office.Word.WordHelper.CallSaveAsFormat failed with this message: Value cannot be null. Parameter name: document OK
When I run the Codeunit manually after declaring all the DotNet variable as RunOnClient No.
I'm sitting in the server pc & it has word installed.
Hi,
Is any of these functions trying to open a window or make any user interaction?
If it is, you should use GUIALLOWED function to avoid user interactions in job queue
Are you executing it manually in the same machine? Maybe Server side needs to have word installed...
The value of the first parameter of the function "CallSaveAsFormat" is found null, that's why it's showing error message.
The above mentioned code working fine when I execute it manually after declaring dot net variables as RUNONCLIENT.
But the same thing is not happening when executing thru NAS after declaring dot net variables As RUN on server side.
deleted
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156