Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Digital bot date

    Posted 10-21-2024 01:24

    Hi everyone, 

    I'm working on displaying the next business date to the customer in our Digital Bot. Currently, I'm using the following expression:

    ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))

    This successfully converts the current UTC time to Melbourne time (with the 11-hour daylight saving adjustment), but it only shows the current date.

    What I need is for the bot to display the next business day so that a callback can be scheduled, and the customer can be informed when to expect it. I'm struggling with this part-how to base it on the bot's schedule and ensure it shows the next business day.

    Any guidance or suggestions would be greatly appreciated!

    Regards

    Phaneendra
    #DigitalBots


    #DigitalChannels

    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------


  • 2.  RE: Digital bot date

    GENESYS
    Posted 10-21-2024 12:05

    Interesting concept, hopefully someone in the community can help with the expression.

    It might also be a good question for the Developer Forum



    ------------------------------
    Sam Jillard
    Online Community Manager/Moderator
    Genesys - Employees
    ------------------------------



  • 3.  RE: Digital bot date

    Posted 10-21-2024 18:54
    Edited by Phaneendra Avatapalli 10-21-2024 18:59

    Thank you Samuel will post it in Developer form as well, hope someone can from community has an answer. 



    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------



  • 4.  RE: Digital bot date
    Best Answer

    Posted 10-22-2024 11:26

    Hi Phaneendra. Could you use ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0))) to add a duration of 1 day and 11 hours to the UTC date? Would that give you the next business day?



    ------------------------------
    Nicole VanWie
    UC Engineer
    ------------------------------



  • 5.  RE: Digital bot date

    Posted 10-22-2024 20:24

    Hi Nicole, Yes it does work thank you so much for your help. Now I have to figure out how to configure so it knows the next business day. We are only open Monday to Friday so if someone does request for a callback on Saturday it should show the next business day which is a Monday. 



    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------



  • 6.  RE: Digital bot date

    Posted 10-23-2024 04:37

    Hi Phaneendra,

    You can use DayOfWeek to find out what weekday it is so you know if you should add 1 or 3 days to the current datetime.

    DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0))))

    Returns

    • Integer : Returns the day of week from the supplied DateTime as a value from 1 to 7. Sunday=1, Monday=2, Tuesday=3, Wednesday=4, Thursday=5, Friday=6, Saturday=7


    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 7.  RE: Digital bot date

    Posted 10-25-2024 01:27
    Edited by Phaneendra Avatapalli 10-25-2024 01:27

    Hi Jan, 

    Thank you for your reply, I got an error when I added this statement saying "Cannot convert expression from type Integer to required type of Date." Not sure if I need to add anything else.

    Regards

    Phaneendra



    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------



  • 8.  RE: Digital bot date

    Posted 10-25-2024 08:14

    Hi,

    It will return the day of week as an integer.

    If you want to return the callback date in one expression the following should work

    DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 6 ?
    ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(3, 11, 0, 0))) :
    ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0)))

    It will add 3 days (returning date for Monday) if it's Friday, otherwise it adds 1 day.



    ------------------------------
    Jan Heinonen
    Contact Center Specialist
    GlobalConnect AB
    ------------------------------



  • 9.  RE: Digital bot date

    Posted 10-25-2024 19:43

    Thank you Jan for your help, based on your code I have further modified the code as per below and it worked.

    If(
        DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 6,
        ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(3, 11, 0, 0))),
        If(
            DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 7,
            ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(2, 11, 0, 0))),
            If(
                DayOfWeek(ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(0, 11, 0, 0)))) == 1,
                ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0))),
                ToDate(AddDuration(GetCurrentDateTimeUtc(), MakeDuration(1, 11, 0, 0)))
            )
        )
    )

    So it does more checks for Saturday and Sunday as well.

    • If today is Friday (6): Adds 3 days to get to Monday.
    • If today is Saturday (7): Adds 2 days to get to Monday.
    • If today is Sunday (1): Adds 1 day to get to Monday.
    • Otherwise: Adds 1 day for the next day, assuming it's a weekday.



    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------



  • 10.  RE: Digital bot date

    Posted 10-25-2024 19:59
    Edited by Phaneendra Avatapalli 10-25-2024 20:28

    Thank you Jan.

    I was also thinking how we can do Genesys schedule to the logic so we don't need worry about daylight saving or holidays in Australia, or do we need to have custom logic for these and change it as we need?



    ------------------------------
    Phaneendra Avatapalli
    Client Support, Desktop Support
    ------------------------------



Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources