Run as tz not working in scheduled export sets

shanker1
Giga Guru

Hi,

The Run as tz is not working in scheduled export sets.

I'm running a scheduled export set at 8.00 AM IST.  But the file generated has SNXXX20201006231000 rather than SNXXX20201007080000

The run as tz is configured to IST. But still the name of the file generated appends the date time as US/Pacific

Is there a way to append the date time to the scheduled export set file with user timezone or based on the current date time its generated?

Regds,

Shanker

1 ACCEPTED SOLUTION

shanker1
Giga Guru

Hi,

I removed the Append timestamp from the export set.

I got this addressed by having a script to get the current date time and update to the Export set file name in the scheduled export set.

 

Regds,

Shanker

View solution in original post

10 REPLIES 10

Hi @shanker 

please ensure about the following note:

If that user has no timezone value associated to his account (in that user's User record) the system will use the default system timezone as configured in the System Property glide.sys.default.tz

If I have answered your question, please mark my response as correct and helpful so that this thread can be closed and others can be benefited by this.

Thank you very much

Cheers
Alberto

@shanker 

Did this solve your question? Or do we need to follow-up on this?

If I have answered your question, please mark my response as correct and helpful so that others with the same question in the future can find it quickly and that it gets removed from the unanswered list.

Thank you very much

Cheers
Alberto

Hi Shanker,

I had similar issue previously but don't remember what was the outcome.

Are you executing it manually and what is your timezone?

Please raise a HI ticket and let us know an update

Regards
Ankur

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

shanker1
Giga Guru

Hi,

I removed the Append timestamp from the export set.

I got this addressed by having a script to get the current date time and update to the Export set file name in the scheduled export set.

 

Regds,

Shanker

Hi Shankar,

Could you please guide me with the script you have written, because I have written the below script inside the Scheduled Export but it did not work. Its always returning me the Export set File name -

 

 

var currentdate = new GlideDate();
var DateTime = currentdate.getByFormat("yyyyMMddHHmmss");

var date = currentdate.getByFormat("yyyyMMdd");
var time =currentdate.getByFormat("HHmmss");
var dateTime = date+"_"+time;

var jprobe = new JavascriptProbe(gs.getProperty("csm.Astro.midserver.name"));
jprobe.setName("SFTP File Transfer of Astro Batch File"); //any name can be given.
jprobe.setJavascript("var req = new SFTP();req.FileTransfer();");
jprobe.addParameter("ftpserver",gs.getProperty('Astro.sftp.server'));
jprobe.addParameter("ftpserverport",gs.getProperty('csm.astro.sftp.server.port'));
jprobe.addParameter("ftpserverusername",gs.getProperty('csm.astro.sftp.username'));
var Encrypter = new GlideEncrypter();
var decrypted = Encrypter.decrypt(gs.getProperty('csm.astro.sftp.password'));
var automation_api = new sn_automation.AutomationAPI();
var password = gs.getProperty('csm.astro.sftp.password');
jprobe.addParameter("ftpserverpassword",decrypted);
jprobe.addParameter("targetPath",gs.getProperty('csm.astro.sftp.path'));

var a = export_set.file_name.split('.');

var fileName = a[0] + "_" +dateTime + "." + a[1];
jprobe.addParameter("fileName", fileName); //export_set.file_name);

var targetFileName = a[0] + "_" +dateTime + "." + a[1];
jprobe.addParameter("targetFileName", targetFileName);

 

 

 

find_real_file.png