How to schedule a report twice a day 10 AM and 6 PM IST?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 10:41 PM
Hi Team,
I want send to report twice per day like 10 AM and 6 PM. So i have selected the periodically option and added the condition as below in script but it's not working. Please help me on this
Conditions:
Script:
answer = ifScript();
function ifScript() {
var gdt = new GlideDateTime();
var currentTime = gdt.getLocalTime().getByFormat('hh:mm:ss');
if (currentTime == "10:00:00" || currentTime == "18:00:00") {
return true;
} else {
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 11:28 PM
Hello @sri83
Your report needs to configured as below:
Starting time = 10am -> sends the report
Repeat interval = 8h - waits 8hours(it will send report at 6pm again)
days = 1 (which means this cycle runs only for 1 day)
The next schedule will be next day at 10am.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 12:51 AM
Hi @sri83 ,
Please see documentation for scheduling a report here: https://docs.servicenow.com/en-US/bundle/utah-platform-administration/page/administer/reference-page...
In general you can accomplish this without scripting as you already have created except, then you would also receive the report at 2AM.
If you would like to utilize the script, to not get the third report, what error does your script throw or what is your output?
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 01:22 AM
Hi Anders,
After execute the job, even single loop also not executing is the script to avoid the 2 AM report
Please help me how to avoid the 2 PM report
Regards,
Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2023 03:35 AM
Hi @sri83 ,
Please utilize this script - this should work:
//Default answer
var answer = false;
//Finds the current time
var now = timenow2();
//Get curent time in HH:mm format
currentTime = timenow2();
if (currentTime == "10:00" || currentTime == "18:00") {
answer = true;
}else{
answer = false;
}
function timenow2()
{
var gdttimeTmp = new GlideDateTime().getDisplayValue();
var gdttime = new GlideDateTime(gdttimeTmp);
var time = gdttime.getTime();
var currentTime = time.getByFormat('HH:mm');
return currentTime;
}
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/