auto incident ticket should get created on first monday of every quarter using scheduled job

Pavani Rishitha
Mega Contributor

How to create an auto incident ticket on first monday of every quarter using scheduled job in servicenow?

 

Need your help on this

3 REPLIES 3

Sohithanjan G
Kilo Sage
Kilo Sage

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

SohithanjanG_0-1709736317965.png

 

🙂

 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Hi @Pavani Rishitha 

If my answer helped

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

AndersBGS
Tera Patron
Tera Patron

Hi @Pavani Rishitha 

 

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/