Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  Invalid Type Cast?

    Posted 05-24-2017 18:49
    No replies, thread closed.

    What is the value of the variable when you attempt to do something like the following: flow.test = ToInt("blocked")?

     

    It doesn't throw an error and it looks like there is something assigned because flow.test==NOT_SET is false.



  • 2.  RE: Invalid Type Cast?

    Posted 05-26-2017 18:00
    No replies, thread closed.

    Hi Dan, thanks for the question!

     

    The answer is that runtime execution should be invoking the error event handling configured in the flow if it encounters this situation as the string is not convertible.

     

    Upon initial investigation of your question above, the issue you've found here appears to be specific to call flows and not inbound email flows where execution would invoke the flow's error handling as expected.

     

    We have created a development ticket internally to investigate this further and correct the call flow runtime behavior in this case.

     

    The following expression could be used to provide a *basic* check to see if a string looks like a good candidate to be converted to an integer value.  In the example below, the assumption is that the string to convert to an integer is stored in a variable called Task.StringToConvert.  What the expression does is check to make sure that there's a value in Task.StringToConvert, trims it, replaces characters that are valid for conversion to an integer with blanks and checks to see if the resulting string after all blank replacements have been made has a length of 0.  If that's the case, then it would call ToInt on Task.StringToConvert.  If for some reason there were still characters hanging around after all those replace calls were made which would be the case when Task.StringToConvert is "blocked", then it would return a default integer value.  That default value is the ", 0)" at the very end of the expression.  Here you go:

     

    If(IsSet(Task.StringToConvert) and Length(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Trim(Task.StringToConvert),"0",""),"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9",""),"-",""))==0, ToInt(Task.StringToConvert), 0)

     

    I hope this helps.

     

    Jim

     

    Note:  I wasn't sure if "blocked" was an arbitrary value but if you're dealing with a phone number like from Call.Ani or the Call.CalledAddress variables, we do have this helpful page regarding the phone number data type ( https://help.mypurecloud.com/articles/about-the-phone-number-data-type/  ) which provides helpful properties for getting at pieces of data from a phone number.



  • 3.  RE: Invalid Type Cast?

    Posted 07-18-2017 13:08
    No replies, thread closed.

    @Dan Fontaine?, I wanted to let you know that deployment of updates that will address the runtime behavior issue described in your original question are now complete.

     

    We have pending updates in the Architect UI's expression help under the examples for the ToInt(<string>) implementation coming which will be deployed at a later date but here are some examples that I think will provide additional clarity in the meantime:

     

    ToInt("") -> A NOT_SET Integer

    ToInt(" ") -> A NOT_SET Integer

    ToInt("blocked") -> Invokes flow error handling

    ToInt("5") -> The Integer value of 5

     

    If a string is convertible to an Integer, you will get the Integer value vack. Conversion of a blank string or a string with one or more spaces will return a NOT_SET Integer and if the string cannot be converted to an integer, the call flow's configured error handling will be invoked.

     

    In order for you get this corrected runtime handling, you will need to re-publish the flow where you originally saw this behavior.

     

    Thanks again and appreciate your feedback!

     

    Jim