We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Discovery Schedules Conditional Scripts

ScottR
Tera Contributor

Hi, is it possible to schedule the following times on a discovery schedule:
1. First Tuesday of the month from 20:00 - 21:00 - Test environment
2. Second Tuesday of the month from 20:00 - 21:00 - Stage / UAT environment
3. Third Tuesday of the month from 20:00 - 21:00 - Prod environment

and is the best way a script?(if so could some one help me as i am a noobie at best when scripting)

 

1 ACCEPTED SOLUTION

Sam Webb
ServiceNow Employee

In that case, something is better than nothing! You'll probably need to write a script which calls the Discovery job and has some function like this included, as I don't recall there being a "third instance of in the month" type iteration in either FD or script criteria.

 

https://www.servicenow.com/community/developer-forum/how-to-schedule-incident-every-third-tuesday-of...

 

Not a scenario I've heard frequently, but I hope that helps!

Sam

View solution in original post

7 REPLIES 7

Sam Webb
ServiceNow Employee

In that case, something is better than nothing! You'll probably need to write a script which calls the Discovery job and has some function like this included, as I don't recall there being a "third instance of in the month" type iteration in either FD or script criteria.

 

https://www.servicenow.com/community/developer-forum/how-to-schedule-incident-every-third-tuesday-of...

 

Not a scenario I've heard frequently, but I hope that helps!

Sam

ScottR
Tera Contributor

Thanks!

Sam Webb
ServiceNow Employee

Scott, 

 

 

Hilariously, I've come across this conversation while looking for a solution to my own ask (which is the same as you had a couple years back). The ideal way is to use "Conditional" on the schedule, and then run a script to check if you're in the right window according to your logic.

 

Like I said, it was a while ago, and I only happened across this - but wanted to share anyway, seeing as I'm here!

 

Sam