Schedule report to run on last Friday of every month

karthikbabu
Giga Expert

Hi friends,

 

I am not a reporting expert. Need help in writing a schedule job for a report to send an email on last friday of every month.

I went to report and then click on schedule, under Run selected monthly and it shows day of the month. Please suggest on how to write a schedule job to send an email on last friday of every month.

 

Thanks in advance,

Karthik

1 ACCEPTED SOLUTION

Marcello Correa
ServiceNow Employee
ServiceNow Employee

More details on my solution... Use the script below in your condition:

function isLastWeekOfMonth() {
	var report_date = new GlideDateTime();
	var days_in_month = report_date.getDaysInMonthUTC();
	var day_of_month = report_date.getDayOfMonthUTC();
	if (day_of_month >= days_in_month - 6) {
		return true;
	} else {
		return false;
	}	
}

isLastWeekOfMonth();

More info can be found below:

Scheduled Reports - Condition Script

 

View solution in original post

13 REPLIES 13

sachin_namjoshi
Kilo Patron
Kilo Patron

Scheduling reports may impact your performance. 

Imaging, you add 100s of reports as scheduled reports and you run them hourly.

Also, scheduled report won't give you dynamic data.

 

Better idea is to publish this report on dashboard so that users will see dynamic data and give link of dashboard to users.

 

Regards,

Sachin

Hi Sachin,

 

Thanks for your immediate response. 

The report already exist in SNOW, all I need is email the report last friday of every month. Any ideas?

 

Thanks,

Karthik.

Check this out

 

 

 

Scheduled Job Condition - First Monday of Every Month

 

you will have to just update scheduled job condition for last friday.

 

Regards,

Sachin

Marcello Correa
ServiceNow Employee
ServiceNow Employee

Hi Karthik,

Have you tried combining a weekly execution for every Friday and a conditional script to only return true when that Friday happens to be the last Friday in a given month?