create a incidents automatically on a specific date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 07:24 AM
I would like to create a schedule that create a incident on a specific date.
from example
08/07/2025
15/07/2025
08/08/2025
etc
I have created a template to create the incident.
I can get it working on the week/day etc.
but can not see a why that I can type my own date's in for it to run

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:05 AM
@DavidPrice In this case you need to create a scripted schedule job with the following script.
(function executeScheduledJob() {
// Define the specific dates (format: yyyy-MM-dd)
var specificDates = [
"2025-07-01",
"2025-07-03",
"2025-07-04",
"2025-07-07",
"2025-07-21"
];
// Get today's date in yyyy-MM-dd format (UTC)
var today = new GlideDate();
var todayStr = today.getByFormat("yyyy-MM-dd");
// Check if today matches one of the specific dates
if (specificDates.indexOf(todayStr) >= 0) {
gs.info("Script executed on scheduled specific date: " + todayStr);
// --- YOUR BUSINESS LOGIC GOES HERE ---
// e.g., create record, trigger flow, clean data, etc.
} else {
gs.info(" Skipped execution: " + todayStr + " is not in the allowed date list.");
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 07:12 AM
Hi Tera
Thank for your help, I have had a goo at it but it is not working I think I must be missing a part
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 08:13 AM
Hi @DavidPrice ,
Hope you're doing well!
If you would like the scheduled job to run at specific dates like 08/07/2025 and 15/07/2025, you can use something like below in your scheduled job condition
var answer = false;
// Only run on your specified dates
var today = new GlideDateTime().getDate(); // e.g., "2025-07-07"
var datesToRun = [
"2025-07-08",
"2025-07-15",
"2025-08-08"
// add more dates here
];
if (datesToRun.indexOf(today) > -1) {
// Run only on specified dates
answer = true;
}
Best Regards,
Sharif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2025 07:13 AM
I have a good at this script
but I am not getting any results
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 12:12 PM
Hi @DavidPrice ,
why? why would you create an incident on specific date? what is the business case? An incident is something in PROD that worked yesterday but not today according to ITIL and best practice.
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/