Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to stop Scheduled Data Exports running on a weekend

matthew_hughes
Kilo Sage

I've created the following Scheduled Data Export:

matthew_hughes_0-1724227090187.png

 

I'm wanting to run this job Monday to Friday and not on the weekend. What I've noticed is that when I select Daily as the Run type, it still runs on a weekend.

 

Does anyone know what I need to do in order to only the run Scheduled Data Export from Monday to Friday and exclude weekends?

 

6 REPLIES 6

Thanks @Anirudh Pathak  Could the following also work:

//Run the Scheduled data Export Monday to Friday
var answer = false;
var dayCheck = new lbgDateUtils;
var dayOfWeek = dayCheck.checkDay();
if (dayOfWeek == 1 || dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 4 || dayOfWeek == 5) {
    answer = true;
}

That will also work, but check if Saturday and Sunday are indeed days 6 and 7 in your instance.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark