Is is possible to create custom time-based triggers for Flow Designer?

Seth Dormaier
Tera Contributor

We have a requirement to run a flow every 2 months on the first of that month. I could set the flow to repeat every 60 days, but over time the execution would float away from the first of the month. 

 

Thanks!

1 ACCEPTED SOLUTION

thomaskennedy
Tera Guru

I'm going to assume by every two months you mean if the current month is evenly divisible by two. In other words that your interval is not every two months starting from date X.

 

Set your flow to run Daily at midnight.

Create two flow variables, month_is_even and day_is_1.

Use the Set Flow Variables flow logic to set their values as follows

var gdt = new GlideDateTime();
return gdt.getMonthLocalTime() % 2 == 0 ? true : false;
var gdt = new GlideDateTime();
return gdt.getDayOfMonthLocalTime() == 1 ? true : false;

Use an If-block to run your flow logic if both variables are true.

thomaskennedy_0-1691449553464.png

 

View solution in original post

3 REPLIES 3

thomaskennedy
Tera Guru

I'm going to assume by every two months you mean if the current month is evenly divisible by two. In other words that your interval is not every two months starting from date X.

 

Set your flow to run Daily at midnight.

Create two flow variables, month_is_even and day_is_1.

Use the Set Flow Variables flow logic to set their values as follows

var gdt = new GlideDateTime();
return gdt.getMonthLocalTime() % 2 == 0 ? true : false;
var gdt = new GlideDateTime();
return gdt.getDayOfMonthLocalTime() == 1 ? true : false;

Use an If-block to run your flow logic if both variables are true.

thomaskennedy_0-1691449553464.png

 

Maik Skoddow
Tera Patron
Tera Patron

Hi

the easiest solution is to use a scheduled script, convert the Flow to a Subflow and execute that Subflow via API

Maik

Yes, set it to run Monthly on day 1, and use the Condition field to check what month it is.