I’m building a snippet in CXone Studio to fetch user metadata from our internal New Relic integration endpoint. The goal is to grab the nr_account_id and pass it to a downstream variable for alerting logic. The REST call itself seems fine because I can see the 200 status code in the logs, but the subsequent ASSIGN action to parse the JSON body keeps failing silently or returning null.
Here is the snippet structure:
{
"actions": [
{
"name": "FetchNRData",
"type": "GetRESTProxy",
"parameters": {
"url": "https://api.newrelic.com/v2/accounts.json",
"method": "GET",
"headers": {
"X-Api-Key": "${env.NR_API_KEY}"
}
}
},
{
"name": "ParseAccountId",
"type": "ASSIGN",
"parameters": {
"variable": "${user.nr_account_id}",
"value": "${actions.FetchNRData.response.body.accounts[0].id}"
}
}
]
}
The FetchNRData action returns a valid JSON structure. I verified this by printing the raw response body to a debug variable. It looks like this:
{
"accounts": [
{
"id": 123456,
"name": "Production",
"region": "US"
}
]
}
However, when the ParseAccountId action runs, ${user.nr_account_id} ends up empty. I’ve tried changing the path to response.body[0].id and even wrapping it in a JSON.parse call, but nothing sticks. The documentation for CXone Studio snippets is a bit sparse on array indexing within the ASSIGN value field.
Is there a specific syntax for accessing nested arrays in the response object? Or does the GetRESTProxy action require a different output format before I can map it? I’ve been stuck on this for two days. It feels like a simple syntax issue, but I can’t find examples that match this exact structure. The logs just show the action completing without errors, which makes debugging harder. I need to get this variable populated before the next routing decision. Any pointers on the correct path string?