The CreatorCon Call for Content is officially open! Get started here.

Script not working in scheduled reports

Sireesha7
Tera Contributor

Hi Team,

 

Good Day !

 

I wrote a script in Scheduled report and it's not working and when I run same script in background script it's working fine.

 

The scenario is a scheduled report that is supposed to run on the second Monday of each quarter . However, it is incorrectly triggering on the first Monday of every week. 

 

I am attaching the script and background script executions as well.

Please check and do the needful !

 

image (9).pngimage (10).png

 

 

Thanks & Regards,

Sai Sireesha G

 

20 REPLIES 20

@Sireesha7 

seems you are in scoped app so use this method getMonthUTC() instead of getMonth()

also use getDayOfMonthUTC() instead of getDayOfMonth()

also use getDayOfWeekUTC() instead of getDayOfWeek()

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar 

 

As per your inputs I have updated the script and tested as well, now I am not able to get the logs also.

 

Please find below screenshot for your reference.

image (12).png

Thanks & Regards,

Sireesha

@Sireesha7 

since you are in scoped app, you need to use gs.info() and not gs.log()

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar 

 

I tried by using gs.info() and not gs.log()

Still facing the same issue 😞

 

Could you please check and do the needful.

 

Thanks & Regards,

Sai Sireesha G

@Sireesha7 

you should use GlideDateTime and not GlideDate at line 1

var gdt = new GlideDateTime()

If my response helped please mark it correct and close the thread so that it benefits future readers.

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