auto incident ticket should get created on first monday of every quarter using scheduled job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 04:53 AM
How to create an auto incident ticket on first monday of every quarter using scheduled job in servicenow?
Need your help on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 06:46 AM
Hi @Pavani Rishitha ,
The below possible options works
You can create a subflow and then trigger it via scheduled job.
Please see KB0961745 for reference.
You would run the scheduled job weekly on a Monday and check if its the first month of the quarter and then since a Monday should occur in First 7 days it should only come true once in that month.
Your script condition should be something like this but please test it in non-prod
var answer = false;
var now = new GlideDateTime();
var month = now.getMonth();
var day = now.getDayOfMonth();
if ((month == 1 || month == 4 || month == 7 || month == 10) && day <= 7) {
answer = true;
}
answer;
Or directly with Scheduled Job like this
🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2024 07:40 AM
Hi @Pavani Rishitha
If my answer helped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 07:30 AM
Why would you like to auto create incident every quarter? Would it be better to create reoccurring task instead?
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/