I’m trying to implement branching logic in a CXone Studio script based on a nested field from an upstream API response. The goal is to route the interaction based on a priority flag inside the JSON payload.
The Data Action returns the payload successfully, and I can see the full JSON in the debug logs. However, when I try to use the ASSIGN action to extract the value and then check it in an IF action, the condition always evaluates to false, or the variable comes back null.
Here is the structure of the JSON coming from the API:
{
"status": "success",
"data": {
"callId": "12345",
"attributes": {
"priority": true,
"tier": "gold"
}
}
}
I’m using the ASSIGN action like this:
- Source:
API.Response.Body.data.attributes.priority - Destination:
user.priority_flag
Then in the IF action:
- Condition:
user.priority_flagis equal totrue
The debug log shows the source path exists, but the assignment seems to fail silently or treat the boolean as a string mismatch. I’ve tried casting it to a boolean in the ASSIGN action, but Studio doesn’t seem to have a direct “cast to bool” option for dynamic sources.
Is there a specific syntax I’m missing for accessing nested JSON keys in Studio variables? Or should I be doing this comparison directly in the IF action without the intermediate ASSIGN step?
If I skip the ASSIGN and put the full path API.Response.Body.data.attributes.priority directly into the IF condition, it throws a validation error saying the type is unknown.
Any pointers on how to handle nested booleans in Studio branching? It’s driving me crazy because the Data Action works fine in the test sandbox.