Genesys Cloud CX

 View Only
Discussion Thread View
  • 1.  Architect Substract hours from schedule

    Posted 06-21-2022 18:41
    Hello Community,

    I have a schedule thats 8:00am - 5:00pm. I need to subtract 1 hour from it so that final output is 8-4pm which i then can evaluate for my flows and logic.

    I have tried things like this but i guess its not that easy.
    FindSchedule("Test Schedule 8am-5pm") - 1.

    The reason for this need is one hour before closure we stop offering certain options.

    While i can create a separate schedule 8-4 and evaluate on that only, it will not be feasible as we have 100+ flows with different schedules like 9-4, 10-5, 7-5 etcc. But the goal is always the same to stop offering 1 hour before the end of schedule.

    Any thoughts or expressions that can be tried?

    Much appreciated.

    Azamat Rustamov


  • 2.  RE: Architect Substract hours from schedule

    Posted 06-21-2022 19:04
    You cannot change the hours on a schedule variable in architect; it doesn't even expose the start & end times.  However when you use the Evaluate Schedule action to test whether the schedule open, you can choose what time you want to use for the evaluation.  So you can tell it to evaluate the time as if it was 1 hour later than it really is.  This trick will only work if all the end times for all your schedules are later than all the start times for all your schedule.  In the example below, I assume that all the schedules end at noon or later and all schedules start strictly before noon.  If there is a schedule from 12:30-2:30 for example, this trick will think that schedule is closed from 12:30-1:30.
    If(ToInt(Hour(GetCurrentDateTimeUtc())) >= 12, AddHours(GetCurrentDateTimeUtc(), 1), GetCurrentDateTimeUtc())​

    This expression says if the hour of the current time is greater than or equal to 12, add 1 hour to the time so 12->1, 1->2, 2->3, etc.  If the hour is less than 12, don't change it.

    If your schedules have start & end times that cross, this trick will not work.  You'll have to go ahead & modify all your schedules or create new schedules.

    Melissa Bailey
    Genesys - Employees