Trying to set a scheduled report to run quarterly

jrusso
Tera Expert

Hi,

I am trying to schedule a quarterly audit report to run every 3 months, on the 15th of the month (April, July, October, January).  The report's filter is set to pull data for the "Last  months".

When I set up the schedule using "Periodically", I entered 90 days for the repeat interval.  If you factor this out over time, the report will constantly run on days other than 15th.  For example, 7/14, 10/12, 1/10 etc.  I guess I could set the repeat interval to 91 days, which would keep it closer to the 15th. 

Is there a way to use the settings to have this run on set days 4/15, 7/15, 10/15, 1/15?

Thanks

John

3 REPLIES 3

Matthew Glenn
Kilo Sage

I'd set the job to run "Daily" and check the Conditional checkbox, which should expose the Condition field. In that Condition field, add the following:

var gdt = new GlideDate(); //creates new date object
var m = gdt.getMonth();  //extracts the month
var d = gdt.getDayOfMonth();  //extracts the day
if((m == "1" || m == "4" || m == "7" || m == "10") & (d == "15")){
    answer = true;
}

 

You'll still need to set the time at which you want the job to run, but it should only run on those 4 dates based on that condition. 

 

ARG645
Tera Guru

jrusso,

Its not possible to specify a particular date when you choose to run a report periodically. What you can do is make your scheduled report conditional. You can do that by checking the Conditional field on the form. 

find_real_file.png

And set your timeZone as Eastern in the Run as tz field [if you dont find that field o the form, go to form layout and get on the surface]

find_real_file.png

          Run: Monthly

          Day: 15

          Time : Whatever...

In the conditional script, use the below script which runs every month on 15th and checks if the month is either 4 or 7 or 10 or 1 

function checkMonth() {
	var estOffset = (3600*(-5));   //EST offset from GMT
	var gdt = new GlideDateTime(); //GMT Time
	gdt.addSeconds(estOffset);
	var month = gdt.getMonthUTC();
	var result = false;
	if(month = 4 || month = 7 || month = 10 || month = 1) {
		result = true;
	}
	return result;
}
checkMonth();

 

Hope this helps. Its an easy and simple way. One advantage with this solution is: The report doent run daily, it runs on specific day (15th). 

 

Thank you,

Aman Gurram

is your question answered ? if its not answered then please let us know your additional questions.
If it is answered, then please close this thread by marking the appropriate answer as Correct. This way others might find this thread helpful in future. Also, please mark the appropriate answers as Helpful if applicable.

 

jrusso
Tera Expert

Thank you both for the recommendations.  I will try this.  Appreciate the quick response and detailed scripting.

John