Genesys Cloud - Main

 View Only

Sign Up

  Thread closed by the administrator, not accepting new replies.
  • 1.  transition map and successTemplate

    Posted 01-31-2025 08:27
    No replies, thread closed.

    Hi All,

    My JSON path and output is as below.

    JSON path : $.conversations[1:3].participants[3].sessions[0].segments[2]

    Output : 

    [
      {
        "conference": false,
        "disconnectType": "client",
        "errorCode": "error.ininedgecontrol.session.inactive",
        "queueId": "91d0955b-6170-4f96-896e-1abfff5cfa68",
        "segmentEnd": "2025-01-21T12:15:25.668Z",
        "segmentStart": "2025-01-21T12:14:47.874Z",
        "segmentType": "wrapup",
        "wrapUpCode": "6fca6038-b22a-416e-ae41-81f55792ff4f",
        "wrapUpNote": "call at 12:16"
      },
      {
        "conference": false,
        "disconnectType": "client",
        "errorCode": "error.ininedgecontrol.session.inactive",
        "queueId": "91d0955b-6170-4f96-896e-1abfff5cfa68",
        "segmentEnd": "2025-01-21T12:13:48.996Z",
        "segmentStart": "2025-01-21T12:10:25.667Z",
        "segmentType": "wrapup",
        "wrapUpCode": "59710d33-ae85-4931-ab2f-8430d4c8a368",
        "wrapUpNote": "Call at 12:13"
      }
    ]
    I would like to display wrapUpCode and wrapUpNote from data action.
    Setup data action as below.
    {
      "translationMap": {
        "wrapcode1": "$.conversations[1].participants[3].sessions[0].segments[2].wrapUpCode",
        "wrapcode2": "$.conversations[3].participants[3].sessions[0].segments[2].wrapUpCode",
        "wrapcodenote1": "x.conversations[1].participants[3].sessions[0].segments[2].wrapUpNote",
        "wrapcodenote2": "x.conversations[3].participants[3].sessions[0].segments[2].wrapUpNote"
      },
      "translationMapDefaults": {
        "wrapcode1": "[\"1\"]}",
        "wrapcode2": "[\"1\"]}",
        "wrapcodenote1": "[\"1\"]}",
        "wrapcodenote2": "[\"1\"]}"
      },
      "successTemplate": "{\"wrapcode1\":  ${successTemplateUtils.firstFromArray(\"${wrapcode1}\", \"$esc.quote$esc.quote\")},\"wrapcode2\":  ${successTemplateUtils.firstFromArray(\"${wrapcode2}\", \"$esc.quote$esc.quote\")},\"wrapcodenote1\":  ${successTemplateUtils.firstFromArray(\"${wrapcodenote1}\", \"$esc.quote$esc.quote\")},\"wrapcodenote2\":  ${successTemplateUtils.firstFromArray(\"${wrapcodenote2}\",\"$esc.quote$esc.quote\")}, \"test\": ${rawResult}}"
    }
    I am getting error when testing data action.
    Apply output transformation: Transform failed to process result using 'successTemplate' template due to error:'Invocation of method 'firstFromArray' in class com.inin.integrations.hedwig.data.variables.SuccessTemplateVelocityTool threw exception com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.fasterxml.jackson.databind.JsonNode[]`: no String-argument constructor/factory method to deserialize from String value ('6fca6038-b22a-416e-ae41-81f55792ff4f') at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 1] at successTemplate[line 1, column 39]' Template:'{"wrapcode1": ${successTemplateUtils.firstFromArray("${wrapcode1}", "$esc.quote$esc.quote")},"wrapcode2": ${successTemplateUtils.firstFromArray("${wrapcode2}", "$esc.quote$esc.quote")},"wrapcodenote1": ${successTemplateUtils.firstFromArray("${wrapcodenote1}", "$esc.quote$esc.quote")},"wrapcodenote2": ${successTemplateUtils.firstFromArray("${wrapcodenote2}","$esc.quote$esc.quote")}, "test": ${rawResult}}'.
    Could someone please help what I am doing wrong here. 

    #API/Integrations

    ------------------------------
    Shishir Srivastava
    Genesys Technical Design Architect
    ------------------------------


  • 2.  RE: transition map and successTemplate

    Posted 01-31-2025 15:21
    No replies, thread closed.

    Hello Shishir,

    You may have better luck reaching out to on our Genesys Cloud Developer Forum. I would recommend posting your question there for someone to parse through your error message.



    ------------------------------
    Jason Kleitz
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: transition map and successTemplate

    Posted 02-24-2025 11:35
    No replies, thread closed.

    Thanks Jason for your input on this. 



    ------------------------------
    Shishir Srivastava
    Genesys Technical Design Architect
    ------------------------------



  • 4.  RE: transition map and successTemplate

    Posted 02-24-2025 11:36
    No replies, thread closed.

    Thanks Jason for your input on this. 



    ------------------------------
    Shishir Srivastava
    Genesys Technical Design Architect
    ------------------------------



  • 5.  RE: transition map and successTemplate
    Best Answer

    Posted 02-21-2025 17:56
    No replies, thread closed.

    For that Output I'd write something more like:

    {
      "translationMap": {
        "wrapcode""$..wrapUpCode",
        "wrapcodenote""$..wrapUpNote"
      },
      "translationMapDefaults": {
        "wrapcode": "[\"1\"]",
        "wrapcodenote""[\"1\"]"
      },
      "successTemplate""{ \"wrapcode\": ${wrapcode}, \"wrapcodenote\": ${wrapcodenote}}"
    }
    Not positive of everything...but that should adapt to however many arrays you have in the output and produce parallel arrays of values. The .. in the Translatio Map says, basically, "find the value named....underneath the path..."
    You'll need to change the Input Contract to have wrapcode and wrapcodenote set as arrays each with one item listed in the array.


    ------------------------------
    George Ganahl GCP, GCSME, ICCE, ICHD, etc.
    Technical Adoption Champion
    Genesys
    ------------------------------



  • 6.  RE: transition map and successTemplate

    Posted 02-24-2025 11:37
    No replies, thread closed.

    Thanks George for your input on this. 



    ------------------------------
    Shishir Srivastava
    Genesys Technical Design Architect
    ------------------------------