Genesys Cloud - Main

 View Only


Discussion Thread View
  • 1.  Using expressions and variables

    Posted 07-18-2021 08:36
    I've been using Genesys Cloud since March, but I still don't feel confident in Architect. I've now got my subscription to Genesys Beyond but it's not covering how to put together the expressions and variables and I think that's the knowledge I'm lacking at the moment.
    Anyone have any suggestions on good places to start so I can learn how to write these?

    Thanks very much
    #ArchitectureandDesign

    ------------------------------
    David Hawken
    Somerset County Council
    ------------------------------


  • 2.  RE: Using expressions and variables

    Top 25 Contributor
    Posted 07-18-2021 22:49
    Edited by Anton Vroon 07-19-2021 16:54
    Hi David.

    Post in here or in developer forum when you get stuck doing something specific and see what people suggest. And then think about why that works or why its a good idea.
    And you slowly build up your knowledge that way, through trial and error, through looking at what others have done, and through something adjacent that uses similar logic and skill sets.

    I have found having some basic coding knowledge and experience help (and it only needs to be basic). You deal with the same sort of concepts, loops, if/then statements, variables, strings, arrays, converting from one to the other etc. 

    Plenty of free online tutorials there, I would suggest something like C#, Java or Jscript.

    And as you get more comfortable also read around good design principles when coding, and apply it to your flows. 
    Keep it readable, break things down into chunks. Sometimes i'll split a really long expression up so instead of having something like this.
    If(Task.AbigNumber > Task.AnotherNumber and Task.ASmallNumber < Task.AnotherNumber, true, false)
    I would create a bool variable like Task.isNumberValid and set it to Task.ANigNumber > Task.AnotherNumber and Task.ASmallNumber < Task.AnotherNumber
    Then the If statement is just If(Task.IsNumberValid, true, false)
    Which is just easier to read, and when you go back over the flow later it makes sense without having to decode what you did earlier, and if you need to look at the detail of it you can.

    Hope it helps.

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



  • 3.  RE: Using expressions and variables

    Posted 07-19-2021 03:39
    Just to add to what Anton's saying, it's also useful to get an understanding of how JSON responses are structured as you start to look into messing around with Data Actions.

    ------------------------------
    Vaun Mccarthy
    NTT New Zealand Limited
    ------------------------------



  • 4.  RE: Using expressions and variables

    Posted 07-19-2021 15:38
    Thanks Anton - I think it's possibly the coding language that i'm missing at the moment. My challenge has been that a third party has set our call flows up, so when I'm reading through Architect, I know what the flow should be doing but I can't understand what each block in the flow is carrying out. My plan is to make a number of test flows myself, playing around with the different things I can do. 
    I'll give you an example of what actually led me to posting - going through the Architect training, it drops this in a section about Expressions to format a number: Expression: ToPhoneNumber(Append("tel: +",ToPhoneNumber(Call.Ani).dialingCode, Task.CustomerInput)
    It then has a brief explanation of Call.Ani, Append etc but it doesn't actually say how to structure this expression or write it out from scratch. That's where I have been struggling.

    I'm going to have a read on some coding basics and see if that makes me feel a bit more comfortable. Thanks very much for taking the time to write this, it's really appreciated


    ------------------------------
    David Hawken
    Somerset County Council
    ------------------------------



  • 5.  RE: Using expressions and variables

    Top 25 Contributor
    Posted 07-19-2021 17:13
    I hear you. I have come into an environment where all the flows are setup, and although functional not necessarily the easiest to follow and in some cases needlessly complex. So I break it down in to chunks, I use the new Common Module flows to break something up like playing music and announcements, or offering callback, and then i can insert that chunk into any other callflow, it helps tidy everything up and makes it much easier to follow

    When in the expression builder click on the F() which will bring up the expression helper, which is really handy for figuring out how each item like Append works

    Sometimes what i will do when there is lots of brackets and nested statements like that is break it down eg
    ToPhoneNumber
    (
     Append
     (
      "tel: +",ToPhoneNumber(Call.Ani).dialingCode, Task.CustomerInput
     )
    )
    And this lets me see what is happening where, and lets me look at things in segments, inner brackets complete first. 
    I'm guessing this is for a callback? So its taking the customer input and trying to convert it to a phone number that can be dialed from Genesys

    To go over that expression:
    ToPhoneNumber is a conversion, so like most programming languages, there is different data types, strings, integers (numbers), etc, PhoneNumber is a data type so its converting everything in the append to a phone number

    Append is just a comma Separate list, whenever you have speech bubbles "" eg "1" that is a string, so even though 1 is a integer because i have it between speech bubbles its treated in that case as a string, eg Append("This ", "1" ," is a string") = "This 1 is a string"
    So in your case tel: + is being appended to the dialing code (also converted to a phone number, not sure that is necessary here), and then some customer input.

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



  • 6.  RE: Using expressions and variables

    Top 25 Contributor
    Posted 24 days ago

    Hi David,

    I'm experiencing the same challenge understanding Variables and Expressions. I did attend the instructor led course for Architect but I'm still having trouble grasping the concept. Were you able to get it? If so how, thx!



    ------------------------------
    Qan T
    Vibrant Emotional Health
    ------------------------------



Need Help finding something?

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