Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Filtering in response template

    Posted 08-01-2025 10:03

    Hi,

    I am having trouble applying filters in a response template.

    Example JSON response is:

    {
      "information": {
        "people": {
          "detail": "Jane",
          "type": "name"
        },
        "Annual Leave": {
          "detail": "Joe",
          "type": "name"
        },
        "Bank Holiday": {
          "detail": "abc@abc.com",
          "type": "email"
        }
      }
    }
    And am trying to get all of the detail objects where the type objects meet name.
    I am using the JSON path: $.information[?(@.type=='name')].detail which works in test tools but when configuring in the data action no data is populated.
    Am expecting something like:
    [
      "Jane",
      "Joe"
    ]
    Thanks Luke

    #DataActions

    ------------------------------
    Luke Mitchell
    Genesys Practice Manager
    Connect
    https://weconnect.tech
    ------------------------------


  • 2.  RE: Filtering in response template

    Posted 08-01-2025 13:42

    Hi @Luke Mitchell,

    Did you check what are you getting in the Data Action test tool under the steps:

    • Execute
    • Resolve Translation Map
    • Apply output transformation 

    I'm making an assumption here, that the data under Contracts is correctly configured, and Data Action returns 200. 

    Thanks,



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

    www.startelecom.cloud

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



  • 3.  RE: Filtering in response template

    Posted 08-04-2025 02:30

    Hi Luke,
    is there an error as response and if so, what is the error message?

    Best regards
    Christoph



    ------------------------------
    Christoph Domaschke
    Leiter Service Center (Cronbank)
    ------------------------------



  • 4.  RE: Filtering in response template

    Posted 08-04-2025 04:41

    Thanks both,

    I have ended up pulling all the information into Architect and then manipulating it 



    ------------------------------
    Luke Mitchell
    Genesys Practice Manager
    Connect
    https://weconnect.tech
    ------------------------------



  • 5.  RE: Filtering in response template
    Best Answer

    Posted 08-04-2025 11:05

    I use the following testing tool.  This is not owned or managed by Genesys so I wouldn't use it for anything sensitive.

    https://www.javainuse.com/jsonpath

    With that I think that this JSONPath does what you want:

    $..[?(@.type=='name')].detail

    The issue with your jsonpath was that it was trying to find a "name" entry directly under the information object, however the name is actually two levels deep. Switching to .. will let it search through everything, although depending on what you ware working with it could possibly return unwanted results from elsewhere in the response.



    ------------------------------
    --Jason
    ------------------------------



  • 6.  RE: Filtering in response template

    Posted 08-04-2025 11:16

    Great thank you Jason, that makes sense



    ------------------------------
    Luke Mitchell
    Genesys Practice Manager
    Connect
    https://weconnect.tech
    ------------------------------