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.

Scheduled Report by every other week on Monday.

d-aizawa
Kilo Sage

Hi.

I want to create a feature to email reports on the 1st and 3rd Mondays 00:00, but I don't know how.

Help me!

1 ACCEPTED SOLUTION

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi d-aizawa,

In the Scheduled Reports ("Reports" > "Scheduled Reports"), check the "Conditional" checkbox.

In the Condition, enter the following script:

var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
var dayOfMonth = gdt.getDayOfMonthLocalTime();
var weekOfMonth = Math.ceil(dayOfMonth/7);

gs.info(dayOfWeek);
gs.info(weekOfMonth);
var answer = false;
if (weekOfMonth == 1 || weekOfMonth == 3 && dayOfWeek == 1) {
  answer = true;
}
answer;

View solution in original post

2 REPLIES 2

Hitoshi Ozawa
Giga Sage
Giga Sage

Hi d-aizawa,

In the Scheduled Reports ("Reports" > "Scheduled Reports"), check the "Conditional" checkbox.

In the Condition, enter the following script:

var gdt = new GlideDateTime();
var dayOfWeek = gdt.getDayOfWeekLocalTime();
var dayOfMonth = gdt.getDayOfMonthLocalTime();
var weekOfMonth = Math.ceil(dayOfMonth/7);

gs.info(dayOfWeek);
gs.info(weekOfMonth);
var answer = false;
if (weekOfMonth == 1 || weekOfMonth == 3 && dayOfWeek == 1) {
  answer = true;
}
answer;

find_real_file.png