The beauty of this approach, is that you don't need to know anything about the schedule other than the keyword assigned to it.
Say you have a schedule controlling business hours. You assign that schedule the keyword "BusinessHours".
When the handler starts, it makes a call to "Get Schedules", specifying the keyword in the argument. You'll be returned a list of schedulers with only one schedule. Then, make a call to "Get Best Schedule", passing the list of schedules, the current date and time ($Now), and "Best".
If receive no schedule back, then the handler is running outside of the scheduled time.
I use this a lot when I have a timer initiated handler. A handler that will run on schedule, even though you know there is nothing for it to do outside of Business Hours. The handler starts by calling a subroutine with code like above, and is returned a boolean. True, continue to process. False, stop processing.
------------------------------
Wayne Rhodeback
Astute, Inc.
------------------------------
Original Message:
Sent: 06-17-2021 05:09
From: Youssef Atef
Subject: Best way to select time in a handler
Wayne,
Would you share more details on how you achieved this part?
I believe using Get Schedule Tool Step in the Designer will return List of String with the Schedules Names only that match the Keyword entered in the Input Box, but how you can retrieve the Schedule Details (i.e. Start Time / End Time / Days ...etc.)
Cheers,
------------------------------
Youssef Atef
Jathwa Technology Solutions
Original Message:
Sent: 06-16-2021 06:49
From: Wayne Rhodeback
Subject: Best way to select time in a handler
You can control it via a schedule in Administrator.
Create a schedule, and assign it a specific keyword.
Then in the handler, ask for the schedule that applies to the current time, and has the keyword you set.
If none are found, then the handler is running outside of the schedule.
This enables you to take advantage of the power of schedules.
------------------------------
Wayne Rhodeback
Astute, Inc.
Original Message:
Sent: 06-15-2021 14:58
From: Tony Curoso
Subject: Best way to select time in a handler
This seems like a basic question but I want to make sure I'm approaching this the right way. I have handler that uses a timer initiator but I really only want it to perform it's function during business hours. Right now it is assigning a date/time variable using $now, then I am extracting the time using toS to get HHMMSS and using comparison steps to see if it falls within the working hours. Is there a better way to do this?
#Handlers
------------------------------
Tony Curoso
American Telesource, Inc.
------------------------------