Report Layout in Email Body

navuser1navuser1 Member Posts: 1,329
edited 2019-02-22 in NAV Three Tier
Dear Sir,

Currently I'm sending NAV PDF Matrix Report in the SMTP Mail attachment using JOB Queue. Now the client wants that the email body should be appeared exactly as Report Layout.

How can I do this ?
Kindly guide me in NAV 2016.

Thanks,
navuser1
Now or Never

Best Answer

  • navuser1navuser1 Member Posts: 1,329
    Answer ✓
    I have achieved the goal. Thank you.
    Now or Never

Answers

  • DuikmeesterDuikmeester Member Posts: 304
    Upgrade to NAV2017 or downgrade the Custom Report layout as email body functionality. (Did this couple months ago and its quite a big job.)
  • navuser1navuser1 Member Posts: 1,329
    edited 2019-02-26
    please guide me for the customization(overview only).
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    Answer ✓
    I have achieved the goal. Thank you.
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    Hi,
    Upgrade to NAV2017 or downgrade the Custom Report layout as email body functionality. (Did this couple months ago and its quite a big job.)

    My code working fine as I required but the same does not work in Job Queue. The culprit code given below.
    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
    

    If you've any suggestion regarding the same please reply.
    Now or Never
  • DuikmeesterDuikmeester Member Posts: 304
    Running this in the jobqueue would require you to install office on the middle-tier and set all variables to not RunOnClient.
  • navuser1navuser1 Member Posts: 1,329
    edited 2019-04-23
    Running this in the jobqueue would require you to install office on the middle-tier and set all variables to not RunOnClient.

    I am working in a Server Computer where SQL, NAS & Office already installed. The manual execution of C/AL Code working fine but Job Queue does not. All variable are SET NO in RunOnClient properties.
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    Running this in the jobqueue would require you to install office on the middle-tier and set all variables to not RunOnClient.

    I have gone thru the important points you mentioned & studied various blog/web search to get something new which I miss out but found nothing as such.

    Do you have any other suggestion regarding the same....?

    BTW, thanks for your time & consideration.
    Now or Never
  • DuikmeesterDuikmeester Member Posts: 304
    Attach a debugger to the NAS as step through it. Also check if the FileName/FileName2 paths are accessible for the middle-tier. WordHelper.CallOpen appears to return Null and failed to open the document.
  • navuser1navuser1 Member Posts: 1,329
    Attach a debugger to the NAS as step through it. Also check if the FileName/FileName2 paths are accessible for the middle-tier. WordHelper.CallOpen appears to return Null and failed to open the document.

    "WordHelper.CallOpen" does not return anything where as every parameter carries the value of this function. I can not understand why it's not able to open the created word file.
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    Thru debugging I have come to know that after execution of WordHelper.CallOpen function it returns null to WordDocument variable hence it creates problem in the next function.

    How do I know what is the reason for this kind of malfunctioning ?
    Now or Never
  • DuikmeesterDuikmeester Member Posts: 304
    Can you open the Word document yourself on the middle-tier? Maybe Word is not configured yet and you get the first-time-start wizard. Or it is not yet activated/licensed.
  • navuser1navuser1 Member Posts: 1,329
    Can you open the Word document yourself on the middle-tier? Maybe Word is not configured yet and you get the first-time-start wizard. Or it is not yet activated/licensed.

    Able to open the word file in middle-tier and the Word is installed with proper licence.
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    I have some doubt that the Wordhelper is not able to work in server-side... o:)
    Now or Never
  • DuikmeesterDuikmeester Member Posts: 304
    Try running Assembly Binding Log Viewer on the middle-tier when executing the Job Queue.
    Maybe you are missing a reference or something. After that don't forget to turn the logging off. Closing the application does not stop logging.
  • navuser1navuser1 Member Posts: 1,329
    Not received any help from FUSLOGVW.exe. Log Bind failures to disk does not create any log and Log all bind to disk provides log that does not match with my problem.
    Now or Never
Sign In or Register to comment.