Script not working in scheduled reports
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2025 10:27 PM - edited 06-04-2025 10:30 PM
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 !
Thanks & Regards,
Sai Sireesha G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 12:21 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 02:17 AM
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.
Thanks & Regards,
Sireesha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 02:35 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 03:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2025 03:19 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader