Genesys Cloud - Main

 View Only
Discussion Thread View
  • 1.  Script input validation

    Posted 03-16-2021 12:41
    Hi everyone,
    in scripts we can challenge an input field over a regex (validation). However this validation only is visual and has no impact on the overall script.
    Has anyone find a way to make validation more useful? Here is an example scenario :
    * let's consider a payment module called from a script, I have an input field for the amount and a button to transfer the customer to the secure flow. My secure flow processes the amount so I want to make sure that the number format is validated. here is my very simple regex : ^\d+,\d{2}$ .
    Now I want to disable the payment button if the format of the amount does not match the regex.
    I ve tried adding this in the validation field of the input: ifElse(^\d+,\d{2}$,{{paymentAmountValidation}}=true,{{paymentAmountValidation}}=false)  but with no luck.
    I was also looking at using a dynamic variable but math.js does not handle regex validation
    I feel that the validation is currently kind of useless. 

    Thank you
    #Omni-ChannelDesktop/UserInterface
    #Unsure/Other

    ------------------------------
    Jacques Tiberghien
    Paxyl Solutions
    ------------------------------


  • 2.  RE: Script input validation

    Posted 03-23-2021 01:16
    Can you try using this format:  [0-9]*(?:,[0-9]{2}).  I have found the \d and \w things don't work so well.  I didn't have time to test, but I found using standard regex patterns seem to work better.


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



  • 3.  RE: Script input validation

    Posted 03-23-2021 08:27
    Hey Robert, thanks for the feedback.
    The regex I used is working fine in the validation option of the input field. My question was more can we use regex in dynamic variable so that validating in input can have a real effect on other components of the script, for instance disabling a button if the regex is not validated? for instance a boolean dynamic variable called
    PaymentValidation = ifElse(equal({{paymentAmount}},[0-9]*(?:,[0-9]{2})),=true,=false)
    As I mentioned math.js does'nt consider regex :-(

    ------------------------------
    Jacques Tiberghien
    Paxyl Solutions
    ------------------------------



  • 4.  RE: Script input validation

    Posted 03-23-2021 23:44
    If you are validating the input, couldn't you put in a negative value as default and then check for positive value of the variable to enable the button?

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



  • 5.  RE: Script input validation

    Posted 03-24-2021 08:24
    Hi Robert,
    that's a good thought but unfortunately even though the input field is not validated, the variable associated to it still contains what has been entered in the field.
    I did not find a way to set a specific variable depending on the status of the validation

    ------------------------------
    Jacques Tiberghien
    Paxyl Solutions
    ------------------------------



  • 6.  RE: Script input validation

    Posted 03-24-2021 08:27


    ------------------------------
    Jacques Tiberghien
    Paxyl Solutions
    ------------------------------



  • 7.  RE: Script input validation

    Posted 12-06-2021 18:06

    Hi Jacques,

    Did you ever get an answer to this one? I'm trying to use validation to prevent a DNC number being passed to a list on button run time if it fails validation.

    Like yourself i'm just finding a change in colour on the input text box but no way to stop it going through.

    Thanks



    ------------------------------
    Rob Anderson
    Openagent.com.au
    ------------------------------



  • 8.  RE: Script input validation

    Posted 12-07-2021 08:41
    Hi Rob,
    unfortunately no,it is still not feasable...
    I see only two ways to do it, either not using the script but rather a custom webapp, or calling a lambda or an API when you click the button to make the regex validation behind the scene.

    I don't see the point of just having a validation indicator. let's hope it ll be fixed some day.

    Regards

    ------------------------------
    Jacques Tiberghien
    Paxyl Solutions
    ------------------------------



Need Help finding something?

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