Genesys Cloud - Main

 View Only


Discussion Thread View
  • 1.  Input of birthdates in a script

    Posted 06-12-2024 06:41

    Hi,

    I want to allow input of birthdates in a script. Because using the calendar in the date input script component requires too many clicks, I want to use the input script component and validate it so that an input of DDMMYYYY is automatically formatted with dots as DD.MM.YYYY. I tried it with the following regex:

    def format_date(input_date):

        formatted_date = re.sub(r'^(\d{2})(\d{2})(\d{4})$', r'\1.\2.\3', input_date)

        return formatted_date

    However, when I test it in preview mode, the input field is highlighted in red, and the format is not converted. Can someone tell me how I need to formulate the regex?

    Viele Grüße,

    Thomas


    #Unsure/Other

    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------


  • 2.  RE: Input of birthdates in a script
    Best Answer

    Posted 06-12-2024 19:37

    Variable formatted_date should be configured as a String - dynamic. 

    Dynamic Value: 

    substr({{input_date}},0,2) + "." + substr({{input_date}},2,2) + "." + substr({{input_date}},4)

    In Preview, it looks like this: 



    ------------------------------
    Tatjana Knezevic

    www.startelecom.cloud

    https://www.linkedin.com/company/star-telecom-www-startelecom-ca-/
    ------------------------------



  • 3.  RE: Input of birthdates in a script

    Posted 06-13-2024 04:44

    Thank you very much for your response, Tatjana.

    Unfortunately, I am not able to see it in the preview mode as it is shown in your screenshot. Apparently, I have configured the input component incorrectly and I can't figure out how to do it. May I ask you to also provide me with a screenshot of your input configuration?

    Viele Grüße,

    Thomas



    ------------------------------
    Thomas Repking
    Canada Life Group Services Limited
    ------------------------------



  • 4.  RE: Input of birthdates in a script

    Posted 06-13-2024 12:24

    As per your note, the input_data should be in the format DDMMYYYY. You can check the validity of the date in your Architect flow by extracting the response either entered by the customer or returned from your CRM. 

    In the Agent Script, I've used the input_date like this.  

    NOTE: The variable input_date must be configured as Input (Yes), as it should be passed from the Architect. 

    Hope this helps. 



    ------------------------------
    Tatjana Knezevic

    www.startelecom.cloud

    https://www.linkedin.com/company/star-telecom-www-startelecom-ca-/
    ------------------------------



Need Help finding something?

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