Genesys Cloud - Main

 View Only

Discussion Thread View
  • 1.  Display day name in communication to customer

    Posted 07-16-2024 23:15

    Hi there,

    I am looking to update my chat bot to say, for example "Happy Tuesday!"

    Currently I have been able to get the day of the week as an integer to display for example "Happy 3!"

    Can you please direct me in how to convert those integers into a string? 

    I wondered if an If() statement would work, nested for each day of the week but I'm having trouble configuring the syntax and hoped there might be a more simple solution. 

    Your help would be very much appreciated,

    Isabella


    #ConversationalAI(Bots,AgentAssist,etc.)

    ------------------------------
    Isabella Clutterham

    Automation Solution Analyst & Developer
    BEYOND BANK AUSTRALIA
    ------------------------------


  • 2.  RE: Display day name in communication to customer
    Best Answer

    Posted 07-17-2024 00:57
    Edited by Cameron Tomlin 07-17-2024 09:27

    Hi Isabella,

    Create a String Collection variable with days of the week, Sun/Mon/Tue/Wed/Thu/Fri/Sat - Lets say you created Task.myList

    Then a String variable to get the current day with following expression using Update Data

    GetAt(Task.myList, (Insert here your Variable/Expression that is Returning 3)-1)

    Hope it helps. 

    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 3.  RE: Display day name in communication to customer

    Posted 07-17-2024 02:32

    Thank you Muhammad, that worked perfectly. 

    I wonder if you can also please suggest how I can convert from UTC to the user's local date and time? (Or failing that, to a pre-set timezone)

    This is the expression in its current form: 

    Happy {{GetAt(Flow.dayName, DayOfWeek(Flow.StartDateTimeUtc)-1)}}!

    Thanks again,

    Isabella



    ------------------------------
    Isabella Clutterham
    Automation Solution Analyst & Developer
    BEYOND BANK AUSTRALIA
    ------------------------------



  • 4.  RE: Display day name in communication to customer

    Posted 07-17-2024 03:40

    No worries Isabella. You can convert UTC to local timezone by adjusting the offset as below

    GetAt(Flow.dayName, DayOfWeek(AddHours(Flow.StartDateTimeUtc, 9))-1)



    ------------------------------
    Cheers
    Zubair
    ------------------------------



  • 5.  RE: Display day name in communication to customer

    Posted 07-18-2024 09:53

    Isabella,

    Muhammad's solution is a good one in this instance, however I wanted to (briefly) offer some perspective on the nested IF() statements you mention.

    Note: this won't work within an expression, but if you need to do this in a Task, then you would use the Switch operation to avoid a large chain of nested IF's.

    I only mention this for anyone who finds this thread in a search.



    ------------------------------
    Paul Simpson
    Views expressed are my own and do not necessarily reflect those of my employer.
    ------------------------------



Need Help finding something?

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