Hey folks,
Running into a head-scratcher with some branching logic in a CXone Studio snippet. I’m trying to validate a JSON payload from a REST call and route based on the result. The logic seems straightforward, but the snippet keeps skipping the ELSE block even when the condition evaluates to false.
Here’s the relevant part of the snippet:
ASSIGN @response = GetRESTProxy("ValidateAccount").response
IF @response.statusCode == 200
ASSIGN @isValid = true
ASSIGN @message = "Account valid"
ELSE IF @response.statusCode == 404
ASSIGN @isValid = false
ASSIGN @message = "Account not found"
ELSE
ASSIGN @isValid = false
ASSIGN @message = "Unknown error: " + @response.statusCode
END IF
When I trace this, @response.statusCode is clearly 500, so it should hit the final ELSE. Instead, it just drops through and @isValid remains null. I’ve double-checked the variable types-statusCode is coming back as a string from the proxy, not an integer. Could that be causing the comparison to fail silently?
I tried casting it with INT(@response.statusCode) but Studio complained about invalid syntax inside the IF condition. Anyone else hit this with string vs int comparisons in Studio snippets?