Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Schedule Group - Get hold of when a schedule group closes

    Posted 09-18-2025 09:48

    Hi,

    I have a use case for our messaging chat where I want to know how many minutes it is until the relevant ScheduleGroup is closing.

    Without going into too much detail we would like to avoid building up a big chat queue during the last X minutes before closing. The rough idea is to not do the Transfer to ACD if the current time is inside the X number of minutes before closing and there is a queue, in this case we will instead send a message to the customer that states that there are no available agents.
    In order to achieve this I need to know when the Schedule group will close. Have anyone built something similar to this or can point me in the right direction?

    Thanks!


    #Architect

    ------------------------------
    /Johan
    ------------------------------


  • 2.  RE: Schedule Group - Get hold of when a schedule group closes

    Posted 09-18-2025 10:58
    Edited by Marcello Jabur 09-18-2025 10:58

    Hi Johan,

    You could try the following:

    On your Inbound Flow, you will Evaluate the Schedule Group (using the default component that does that), and there is an output parameter on that component that will return to you all Schedules that are active.

    With that, when the conversation goes through the "Open" path, you will know the Schedule (or Schedules) that were used to consider it as open.

    You can now use the Schedules API to get more details on that object:

    GET /api/v2/architect/schedules?name=XXXXXXX

    XXXXXXX being the Schedule object that was outputed on the Flow as the "Active Schedule".

    The response from that API should contain all the details, including the parts that I show below:

    {
          "id": "xxxxxxxxxxxxxx",
          "name": "XXXXXXX",
          "start": "2025-07-01T09:00:00.000",
          "end": "2025-07-01T17:00:00.000",
          "rrule": "FREQ=WEEKLY;WKST=SU;BYDAY=MO,TU,WE,TH,FR"

    }

    With the above you can probably calculate now how much longer you have until the Schedule Group will be considered "Closed".

    The "end" attribute shows this Schedule should close at 5PM.

    And the "rrule" attribute shows this happens from Monday to Friday, but that's probably not even needed, since you already know the Schedule is currently open (after the Flow went through the "Open" path from the Evaluate Schedule Group.

    Of course all the above will depend on how you are setting your Schedule Group, since there are several different ways of setting them up.



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 3.  RE: Schedule Group - Get hold of when a schedule group closes
    Best Answer

    Posted 09-19-2025 03:48
    Edited by Johan Ström 09-22-2025 02:56

    Hello,

    another approach might be easier, just check if the schedule group would be open/closed in X minutes.

    Let's say X should be 30 minutes before the schedule group closes.
    DateTime variable nowPlus30MinUTC = AddMinutes(GetCurrentDateTimeUtc(), 30)
    Then use this as input for an Evaluate Schedule Group step.

    For handling UTC vs. local time and DST, there are some suggestions: 
    https://help.mypurecloud.com/articles/datetime-values-in-architect-flows-and-daylight-savings-time-dst-calculations/#citem_4ad7-e04a



    ------------------------------
    Christian Karpp
    Principal Implementation Consultant
    ------------------------------



  • 4.  RE: Schedule Group - Get hold of when a schedule group closes

    Posted 09-19-2025 06:44

    Ooh, great idea Christian, I always just use the "Current" option on the "Schedule Evaluation Date Time", it didn't even cross my mind that there was another option there to change the evaluation time.

    That's WAY easier than going with the API route haha.

    Good to know about that option!



    ------------------------------
    Marcello Jabur
    ------------------------------



  • 5.  RE: Schedule Group - Get hold of when a schedule group closes

    Posted 09-19-2025 07:12
    Edited by Johan Ström 09-19-2025 07:13

    Thanks Christian!

    This solution seems to be working fine 👍

    It also seems that as long as I use UTC in the Flow I don't need to do any logic for making up for different time zones on the schedule group. It seems that the Schedule Group Evaluation takes care of this for me.



    ------------------------------
    /Johan
    ------------------------------