Legacy Dev Forum Posts

 View Only

Sign Up

Learning expressions - need help in getting started

  • 1.  Learning expressions - need help in getting started

    Posted 06-05-2025 19:16

    Jlam | 2024-06-02 05:39:34 UTC | #1

    Hi, I read this article Work with expressions article but still don't understand the basics of expressions.

    What should I start learning? Coding? If so which language? Is an expression coding instructions?


    tim.smith | 2024-06-03 16:33:33 UTC | #2

    Expressions are just how you write "if statements" to make decisions in an Architect flow. What condition are you having trouble writing an expression for?


    SimonBrown | 2024-06-03 17:22:53 UTC | #3

    This IS another example of where an expression editor sandbox or basic testing facility would alleviate a lot of the expression editor work pain points.

    However, you do need to read the material and examples (again though, examples are EXTREMELY poor and not real world most of the time) I feel the expression editor help, specially all of the functions needs an overall with much better examples of usage.


    tim.smith | 2024-06-03 17:28:24 UTC | #4

    I would encourage you to share that feedback as a suggestion on the ideas portal; it's unlikely the product manager for the feature will see it here. https://genesyscloud.ideas.aha.io/


    SimonBrown | 2024-06-03 17:34:33 UTC | #5

    One idea for expression editor is here I encourage the OP to vote, and any others who regularly despair at the expression editor short comings.

    As for documentation updates, that seems to get little if any traction in Aha.

    I could create dozens of Aha items on enhancements and short comings but when I see long running, heavily voted items left to rot you begin to think that the system does not work that well.


    Jlam | 2024-06-03 22:20:10 UTC | #6

    Hi Tim, here's an example of a expression I'm trying to understand. The following experssion

    Count(Find(Task.blockedNumbers, ToPhoneNumber(Call.Ani))) > 0

    This is from [https://help.mypurecloud.com/articles/block-incoming-calls-from-specific-numbers/](https://Blocking incoming calls)

    I don't understand the logic when reading expressions, the closest thing that is familiar to me is writing HTML.


    MelissaBailey | 2024-06-03 22:51:50 UTC | #7

    ToPhoneNumber: Converts a value to a PhoneNumber

    Find: Finds all occurrences of an item in a collection and returns an Integer collection of indices where that item was found. If the item is not found, an empty Integer collection is returned.

    Count: Gets the number of items in a collection.

    So Task.blockedNumbers must be a collection of phone numbers (see https://help.mypurecloud.com/articles/about-the-phone-number-data-type/ to understand the phone number data type) and this expression is checking to see if the value of Call.Ani (see https://help.mypurecloud.com/articles/architect-default-variables/) is one of them.


    Jlam | 2024-06-07 05:46:20 UTC | #8

    Melissa I think you lit up a light bulb in my head! :smiley:

    Breaking this expression apart makes more sense!

    Count(Find(Task.blockedNumbers, ToPhoneNumber(Call.Ani))) > 0

    Why is the Count before the find? What is the purpose of the parentheses? (Find(Task.blockedNumbers, ToPhoneNumber(Call.Ani))) <-- why are there 3 here?

    Thank you.


    SimonBrown | 2024-06-07 08:50:14 UTC | #9

    Basic functions pass parameters in parenthesis. So Count, Find and ToPhoneNumber are all functions. Find and ToPhoneNumber are each passed in as parameters, hence the 3 closing parenthesis.

    It is basic coding so probably worth reading linked material and any basic coding site to understand fundamentals. It's straightforward when you get it, and breaking it down, spacing it out helps.


    Jlam | 2024-06-07 16:10:50 UTC | #10

    Ty. What coding language should I be looking at? Python?


    system | 2024-07-08 16:11:31 UTC | #11

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 26563