Post file to a specific path on Mid server using Javascriptprobe?

snowtech
Mega Contributor

Using the blog below I was able to setup a pdf file to be posted on the mid server.

http://www.john-james-andersen.com/blog/service-now/javascriptprobe-and-mid-server-script-includes.html

Is it possible to control the folder path where the file is posted to? Currently it is posted directly in the agents folder.

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Snowtech,

In the execute method there is one line of code where you can say where to put that file like C drive etc.

 var f = new this.File(this.filename);

instead have it like this

var filePath = 'C:/Mid Servers/mid.helsinki/agent/export/customFolder/' + this.filename;

 var f = new this.File(filePath);

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Hi Ankur,

Need your help in resolving issue of file not getting created in folder on MID Server. I can see entries in the ECC Queue. Can you please provide some steps to resolve this issue?

var jprobe = new JavascriptProbe(mid_server);
jprobe.setName('test'); //any name can be given
jprobe.setJavascript('ms.log("JaveScriptProbe is working");var fileTransfer= new ExportToMIDServer(); fileTransfer.execute();');
jprobe.addParameter('source', mid_server_temp_path);
jprobe.addParameter('filename', file_name);
jprobe.addParameter('filePayload', base64EncodeString);
jprobe.create();

Thanks,

Ashraf