Quantcast
Channel: Dynamics 365 Business Central/NAV User Group
Viewing all articles
Browse latest Browse all 11285

Forum Post: RE: Auto emailing Remittance Advice with NAV '16

$
0
0
When I go to save this function I get a message stating: "you have specified an unknown variable. Language 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] BEGIN ClientFileName := ToFile; IF NOT DOWNLOAD(ServerFileName, '', ' ','', ClientFileName) THEN EXIT(''); IF CREATE(objScript,TRUE,TRUE) THEN BEGIN CR := ' '; CR[1] := 13; objScript.Language := 'VBScript'; objScript.AddCode( '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; END; EXIT(ClientFileName)

Viewing all articles
Browse latest Browse all 11285

Trending Articles