The translationMap does not support Velocity, it only supports JSONPath. Both Velocity and JSONPath have size() methods, which is making this confusing.
Original Message:
Sent: 05-09-2025 01:37
From: Hanumantha Rao
Subject: Velocity Macros and Functions for Translation Map/Success Template
Hi @George Ganahl @Jason Mathison Thanks for your response.
from the same page Apache Velocity Engine - User Guide I can use size() method and it returns Integer or array of Integer the way we use.
example $.participants.size() or $.participants[*].size() ; discussed the same here Getting no data for translatemap variable - Data Actions - Genesys Cloud Developer Forum ;
so I understand how to use size() method in my Translation map. as I can see get(2) from below picture (from Apache Velocity page) and try to use isEmpty or get(index) -- I will get error in Translation Map stating function doesn't exist.
"Resolve translation map: Failed while processing the translation map. Could not resolve value for the key: 'abc' and no default value was configured. Additional details: Function with name: get does not exist."
Assume I am not configuring the output contracts properly, error text clearly indicating it. take an example of JSON result from API output /api/v2/conversations/emails/${input.conversationId}

Thank you !
------------------------------
Hanumantha Rao
Original Message:
Sent: 05-08-2025 11:08
From: George Ganahl
Subject: Velocity Macros and Functions for Translation Map/Success Template
I also make a lot of use of https://velocity.apache.org/engine/1.7/user-guide.html
------------------------------
George Ganahl GCCX-AI, GCP, GCSME, ICCE, ICHD, etc.
Technical Adoption Champion
Genesys
Original Message:
Sent: 05-07-2025 16:38
From: Nick Tait
Subject: Velocity Macros and Functions for Translation Map/Success Template
Elaborating on what Jason said, these are the resources that I have found most useful:
- https://help.mypurecloud.com/articles/response-configuration-data-actions/
- https://help.mypurecloud.com/articles/velocity-macros-data-actions/
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 05-07-2025 00:19
From: Hanumantha Rao
Subject: Velocity Macros and Functions for Translation Map/Success Template
Hi @Nick Tait Thanks for your answer. I am actually looking which document is helpful to learn different functions we can try similar to size () in above example.
Thank you !
------------------------------
Hanumantha Rao
Original Message:
Sent: 05-06-2025 17:10
From: Nick Tait
Subject: Velocity Macros and Functions for Translation Map/Success Template
Comparing what you have with something I've written, it looks like your issue in the stats.count example is that you are selecting a single record by index (0) then trying to count it. Try changing "[0]" to "[*]" and see if that makes a difference? In other words:
{
"translationMap": {
"oActiveUserCount": "$.results[*].data[?(@.metric=='oActiveUsers')].stats.count
}
}
For the concat example, the documentation suggests that the concat function takes a single argument, which suggests that you might try this:
$.records[0].Name.concat(" - ").concat($.records[0].Account.Name)
(Of course this begs the question whether it is even possible to concatenate an array of values? But in your example it looks like you don't actually need to do that?)
Hope these ideas help?
Nick.
------------------------------
Nick Tait
Genesys Consultant
Original Message:
Sent: 05-05-2025 03:14
From: Hanumantha Rao
Subject: Velocity Macros and Functions for Translation Map/Success Template
Hello Developer Community,
After reading some previous posts I learned usage of stats.count ; size() ; $.concat
which document helpful to learn different functions we can use similar to size() ?
only size() worked, get(int index) or others returning error when used in Translation map. Below are article links, which I am referring
{
"translationMap": {
"oActiveUserCount": "$.results[0].data[?(@.metric=='oActiveUsers')].stats.count
}
{
"translationMap": {
"OnIdleAgentCount": ".entities.size()"
},
$.concat($.records[0].Name," - ",$.records[0].Account.Name)
https://developer.genesys.cloud/forum/t/data-actions-convert-string-to-integer-in-sucesstemplate/12188
https://developer.genesys.cloud/forum/t/incorrect-result-from-size-function-in-translation-map/14370
Thank you!
#DataActions
------------------------------
Hanumantha Rao
------------------------------