The CreatorCon Call for Content is officially open! Get started here.

Run a schedule job at 2 am from Monday to Friday and at 8 am on Weekends.

SNewbies
Tera Contributor

Hello!

I want to run a Scheduled Job at 2 am from Monday to Friday and run same Scheduled Job at 8 am on Saturday and Sunday. How can do this?

Thank you

6 REPLIES 6

Service_RNow
Mega Sage

Hi @SNewbies 

scheduled-send-only-on-monday-wednesday-friday-script 

In Scheduled Jobs please enable the Condition checkbox and paste the below code.

 

var answer = false;

 

var now = new GlideDateTime();

 

if(now.getDayOfWeekUTC() !=6 && now.getDayOfWeekUTC() !=7 )       // this scheduled job will run only on Weekdays

 

{

 

      answer = true;

 

}

 

and configure our condition here

RamSingh_0-1709268937723.png

 

Please mark reply as Helpful/Correct, if applicable. Thanks!

Hello!

Thank you for your response.

I want to run the same scheduled job for weekends too but at different time.

It should run at 2 am on weekdays and at 8 am on weekends.

Hi @SNewbies this is not possible, since you need to define time in schedule job.

Regards
Harish

Hi @SNewbies 

I found one article regarding this requirement please follow this it willl be helpful to you

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0750527 

 

 Please mark reply as Helpful/Correct, if applicable. Thanks!