Auto emailing Remittance Advice with NAV '16

Hey All, 

I've got a client printing out their remittances every week for mailing and they'd like to convert to emailing them out from NAV. 

Could you point me towards a tutorial or proper reading on this functional change?


  • Step 1 - Right where you are printing the remittance add a option for Emailing
    Step 2 - Save the report as PDF
    Step 3 - Write a code to get the to email id where this document should go. Create the subject and body for the email.
    Step 4 - Add the report as an attachment.
    Step 5- Send the attachment as email.
  • In reply to sbhatbng:

    I found this walkthrough on adding this functionality for NAV 2013 R2 will that still be applicable for NAV 2016?
  • In reply to Rob :

    Yes, it should work in NAv 2016 too.
  • In reply to sbhatbng:

    When I go to save this function I get a message stating:

    "you have specified an unknown variable.
    Define the variable under Global C/AL symbols"

    Where should I start in making sure the Microsoft script control automation is loaded correctly?

    LOCAL DownloadToClientFileName(ServerFileName : Text[250];ToFile : Text[250]) : Text[250]
    ClientFileName := ToFile;
    IF NOT DOWNLOAD(ServerFileName, '', '<TEMP>','', ClientFileName) THEN
    CR := ' '; CR[1] := 13;
    objScript.Language := 'VBScript';
    'function RenameTempFile(fromFile, toFile)'+CR+
    'set fso = createobject("Scripting.FileSystemObject")'+CR+
    'set x = createobject("Scriptlet.TypeLib")'+CR+
    'path = fso.getparentfoldername(fromFile)'+CR+
    'toPath = path+"\"+left(x.GUID,38)'+CR+
    'fso.CreateFolder toPath'+CR+
    'fso.MoveFile fromFile, toPath+"\"+toFile'+CR+
    'RenameTempFile = toPath'+CR+
    'end function');Language
    ClientFileName := objScript.Eval('RenameTempFile("'+ClientFileName+'","'+ToFile+'")');
    ClientFileName := ClientFileName+'\'+ToFile;
  • In reply to Rob :

    Rob - Language is part of the Automation of the variable objScript, please make sure when you define the variable Objscript you select the correct automation and it will then compile.