Genesys Cloud - Main

 View Only
Discussion Thread View
  • 1.  Assign a value to an attribute from a script

    Posted 11-23-2021 18:49
    Hello,

    When customers contact us via chat, we are retrieving the geo-location attribute which is a 2-letter string (example: US for united States).
    I am trying to make the attribute available for the agents. I am able to have the attribute populated in the script when they pick up an interaction. However, I would like to have the full country name populated, not just the 2-letter string.

    I am trying to know if it is doable via the script or from the flow directly.
    In the flow, the Set Screen Pop for the script contains the input If(IsNotSetOrEmpty(Flow.Location), "Country not available", Flow.Location).

    Is there a way in the flow to use that type of expression such as:
    If(Flow.Location == us, United States) or If(Flow.Location == fr, France) or etc...

    Or would it have to be set in the script?
    #Ask Me Anything (AMA)
    #ArchitectureandDesign
    #Unsure/Other

    ------------------------------
    Louis D.
    ------------------------------


  • 2.  RE: Assign a value to an attribute from a script

    Posted 11-24-2021 01:17
    Have you thought about using a data table and a data action in the script to read in the full name?  Much easier to manage than a bunch of If statements.

    ------------------------------
    Robert Wakefield-Carl
    Avtex Solutions, LLC
    Contact Center Innovation Architect
    robertwc@avtex.com
    https://www.Avtex.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Assign a value to an attribute from a script

    Posted 11-24-2021 12:49
    Hi Robert,

    I haven't had the chance to explore this as I am not familiar with how to do it. I will look into this. 
    Thank you,

    ------------------------------
    Louis D.
    ------------------------------



  • 4.  RE: Assign a value to an attribute from a script

    GENESYS
    Posted 11-24-2021 08:51
    You can embed ifs inside an expression

    If(IsNotSetOrEmpty(Flow.Location), "Country not available", If(Flow.Location == "us", "United States", If(Flow.Location == "fr", "France", Flow.Location)))

    ------------------------------
    Melissa Bailey
    Genesys - Employees
    ------------------------------



  • 5.  RE: Assign a value to an attribute from a script

    Posted 11-24-2021 12:41
    Edited by Matt Lawson 05-09-2022 09:34
    Hi Melissa,

    I tried that and it works. However, as the list contains about 250 countries, the formula gets long and gives me an error. I am not sure if it is in my formula or due to character limits.

    ------------------------------
    Louis D.
    ------------------------------



  • 6.  RE: Assign a value to an attribute from a script

    Top 25 Contributor
    Posted 11-24-2021 14:24
    Robert's suggestion of using a Datatable will solve that, and it is actually not so hard to setup and use.

    In Admin got to DataTables
    Create new. You just need two columns for this. The key column will be your 2 digit location codes, and the second column will be your full country name. 
    If you have a spreadsheet save it as a csv file and just import all the values in, rather than entering them all in manually.

    In your flow use the Data Table Lookup action.
    Input is just your flow.location
    Output will be the full country name which you can assign to a variable and the do whatever you want with it.

    ------------------------------
    Anton Vroon
    KiwiBank
    ------------------------------



  • 7.  RE: Assign a value to an attribute from a script

    Posted 11-24-2021 14:37
    Hi Anton,

    That's great, I tried and it worked. However, it seems that my csv file may be extensive. Is there a limitation of rows? because it only import half of the rows in the spreadsheet.

    ------------------------------
    Louis D.
    ------------------------------



  • 8.  RE: Assign a value to an attribute from a script

    Top 25 Contributor
    Posted 11-24-2021 15:04
    Each Datatable has a limit of 5000 rows, which should be way more than the number of countries there are (195 according to google)
    https://help.mypurecloud.com/articles/work-with-data-tables/

    When you are in the data table, up the top click on manage imports, then recent imports. It should show how many it attempted and how many failed.
    Might pay to look if there is anything wrong in the csv file, like commas in any of the country names or other weird characters that might need removing

    ------------------------------
    Anton Vroon
    KiwiBank
    ------------------------------



  • 9.  RE: Assign a value to an attribute from a script

    Posted 11-24-2021 15:33
    Looks like I had to save as CSV.UTF-8
    Seems like it worked. Thank you very much for your help

    ------------------------------
    Louis D.
    ------------------------------



Need Help finding something?

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