Create custom time-based triggers for Flow Designer - every 2nd Tuesday of the Month

Peter Williams
Kilo Sage

Hello all

Happy New Years.

 

i have a requirement to create a custom time base trigger for Flow designer

what i need to do is:

 

1) have the trigger run every 2nd Tuesday of the month

2) have another trigger to run every 2nd Tuesday of a specific month ( ex. 2nd Tuesday of Jan. or 2nd Tuesday of Oct.)

 

i know that i can set the trigger to run daily but how do i calculate to for the other items above

 

 

any and all help is appricated 

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

I think you need an if script to identify if today's date is Tuesday and today's date is greater than 7. You can get Day of the week using getDayOfWeekLocalTime() function.

That will help you with the 1st use case.

 

For the 2nd use case use the logic of the first and then use getMonthLocalTime to get the month. Below link should help you with these functions.

 

https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server/no-namespace/c_APIRef#r_Scop...

 

 


Please mark this response as correct or helpful if it assisted you with your question.

i am still confused on how to incorporate that into the flow designer 

So your trigger condition should be a Scheduler triggering every Tuesday

SanjivMeher_0-1704743687622.png

 

Then you need a Flow action to identify, if it is 2nd Tuesday. You can get the logic from below thread

https://www.servicenow.com/community/itsm-forum/how-to-get-second-tuesday-of-every-month-for-schedul...

 

The result of the above action, you can validate using an If Flow logic in the Flow and then proceed with the job you want to perform.


Please mark this response as correct or helpful if it assisted you with your question.

Narsing1
Mega Sage

Please check this KB Article

KB0961745 

To calculate the Month & day of week, can think of using these methods

var now = new GlideDateTime();
var month = now.getMonth();
var day = now.getDayOfMonth();

Or

You can think of utilizing eventQueueScheduled & a script action combination

 

Thanks,

Narsing