Time Period

yoli1
Tera Contributor

Hello Team, is it possible to add a quarterly period  ?

13 REPLIES 13

I'm sorry but I do not have time to writeup the details of what you need to do.  You have everything you need though.

 

Personally I would just update the form and put the script in you have since it should work.

 

yoli1
Tera Contributor

We can use  60 days but not every mouth have the same days. maybe 28days maybe 31days

Mike Patel
Tera Sage

I use below in condition section

var gdt = new GlideDateTime();
var mon = gdt.getMonth();
(mon == 1 || mon == 4 || mon == 7 || mon == 10);

yoli1
Tera Contributor

Thanks!

Jim Coyne
Kilo Patron

To be clear, you want to set the "Run" field to "Monthly" and "Day" to "1" so the Workflow Schedule is triggered every 1st of the month, but then having the "Conditional" field checked, the schedule will not actually run the selected "Workflow" unless the "Condition" field evaluates "true".  As mentioned by @DrewW , you will need to add the fields to the form.

 

And as @Mike Patel wrote earlier, your script could look something like:

 

 

answer = (function() {
    //get the current month, in local time
    var gdt = new GlideDateTime();
    var month = gdt.getMonthLocalTime();

    //is today the start of a new quarter?
    return (month == 1 || month == 4 || month == 7 || month == 10);
})();

 

 

 

You would change the 1, 4, 7 and 10 if you are dealing with different quarters (such as financial quarters instead of calendar quarters).

 

JimCoyne_0-1693499299379.png