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

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

Hi Ankur,

I'm trying to create a customized csv and export it to MID Server custom folder. I looked at export set but I don't have customization file. Can you please provide some suggestions?

 

Thanks,

Ashraf

Hi,

using export set you cannot send customize file; only table data is allowed

I would recommend using custom mid server script include to handle this

Regards
Ankur

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

Thank you. Have no idea on mid server scripts, any leads will be appreciated.