You could try using a data action to set the "callCounter" variable and continue with the logic check Jason provided?
The below requires the flow id and interval in "YYYY-MM-DDTHH:00:00.000Z/YYYY-MM-DDTHH:00:00.000Z" format to return a single integer for flow entries.
/api/v2/analytics/flows/aggregates/query
Request Body Template:
{
"interval": "${input.Interval}",
"groupBy": [
"flowId"
],
"metrics": [
"tFlow"
],
"filter": {
"predicates": [
{
"type": "dimension",
"dimension": "flowId",
"operator": "matches",
"value": "${input.FlowID}"
}
],
"type": "and"
}
}
Response map:
{
"translationMap": {
"Total": "results[0].data[0].metrics[0].stats.count"
},
"translationMapDefaults": {
"Total": "0"
},
"successTemplate": "{\"Total\": ${Total}}"
}
Not sure if high traffic and latency in updating the metrics might lead to more than 1 call retrieving the same API "Total" result at roughly the same time which would lead to multiple calls following the "forward 4th call to external" path?
------------------------------
Travers Dunne
------------------------------
Original Message:
Sent: 12-24-2025 11:19
From: Roberta Wermer
Subject: How to forward every fourth call to another external number
Hi Jason,
How do you define a variable in Genesys Architect to be system persistent rather than interaction specific?
I had thought the default is that a flow variable only exists within the interaction and for the duration of that interaction. If two calls come in on the same flow, I have assumed they each were agnostic to variable value set for the other interaction when I use Update Data?
In other CCaaS tools I have have had to take additional steps to make the value persistent across calls. I would like to understand how you are doing this in Genesys without creating a table or other external location to set/get/update the variable.
Thanks,
Roberta
------------------------------
Roberta Wermer
Infrastructure Engineer
------------------------------
Original Message:
Sent: 12-24-2025 10:31
From: Jason Kleitz
Subject: How to forward every fourth call to another external number
Hello Jorge,
I believe you should be able to accomplish this in Architect. You would want to create a flow-level counter variable, something like 'callCounter'.
Use a 'Set Variable' action at the start of your flow and set callCounter = $(callCounter) + 1
Add a 'Decision' action to check if it's the 4th call. Use a condition like $(callCounter) % 4 == 0
If the condition is true (meaning it was the 4th call, You can use a 'Transfer to Number' action to forward to your external number
If the condition is false then it should continue as the normal call flow.
------------------------------
Jason Kleitz
Online Community Manager/Moderator