Original Message:
Sent: 02-21-2025 17:55
From: George Ganahl
Subject: transition map and successTemplate
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
Original Message:
Sent: 01-31-2025 08:27
From: Shishir Srivastava
Subject: transition map and successTemplate
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
------------------------------