CXone Studio ASSIGN and IF logic failing on string comparison

I’m trying to set up a simple branch in CXone Studio using ASSIGN and IF actions, but the logic isn’t triggering as expected. I need to route calls based on a custom attribute call_priority that comes from the IVR. The attribute is a string, either ‘high’ or ‘low’. I’m using an ASSIGN action to set a local variable local_priority to call_priority, then an IF action to check if local_priority equals ‘high’. The syntax looks right to me, but the flow always falls through to the else block. I’ve verified the attribute value is correct by logging it, and it’s definitely ‘high’ when it should be. The IF action configuration is straightforward, just a simple string comparison. I don’t see any obvious syntax errors in the Studio UI, but the branch never takes the true path. It’s frustrating because this should be a basic operation. I’ve tried trimming whitespace and forcing the string type in the ASSIGN, but nothing changes. The flow just ignores the condition entirely. Here’s the snippet of the ASSIGN and IF configuration I’m using:

{
 "assign": {
 "target": "local_priority",
 "value": "{{call_priority}}"
 },
 "if": {
 "condition": "{{local_priority}} == 'high'",
 "trueBranch": "route_to_priority_queue",
 "falseBranch": "default_queue"
 }
}

The issue seems to be with how Studio handles the string comparison in the IF condition. I’ve checked the documentation, and it says string comparisons are case-sensitive, which I’ve accounted for. The attribute call_priority is definitely lowercase ‘high’. I’m not sure if there’s a hidden character or encoding issue, or if the syntax for the IF condition is slightly different than I think. I’ve also tried using the equals function instead of ==, but that didn’t help either. The flow just doesn’t branch correctly. I need to get this working before our next deployment, so any help would be appreciated. I’m stuck on this and don’t know what else to try. The logs show the variable is set, but the IF action doesn’t seem to evaluate it properly. I’m running out of ideas on how to debug this within the Studio environment. It feels like a bug, but I’m probably missing something obvious. I’ve checked the variable scope, and it should be visible to the IF action. The flow is linear, so there’s no concurrency issue. I just can’t get the branch to work.

Have you checked the exact casing and whitespace in that call_priority attribute? It’s surprisingly easy for an IVR to append a trailing space or capitalize the value unexpectedly, which breaks a strict string equality check in Studio. I’ve seen this exact issue a few times where the logic looks perfect on paper but fails in production because of invisible characters.

Try adding a TRIM action right before your IF statement. It’s a cheap insurance policy. Here is how that flow should look:

  1. ASSIGN: Set local_priority to {{contact.attributes.call_priority}}.
  2. TRIM: Set local_priority_clean to TRIM(local_priority). This strips any leading or trailing whitespace.
  3. IF: Check if local_priority_clean equals 'high'.

If that doesn’t fix it, the next thing to verify is the data type. Sometimes the IVR passes the priority as an integer (e.g., 1 for high, 0 for low) even if you think it’s a string. If the source is numeric, your string comparison will always fail. You can debug this by adding a simple LOG action right before the IF statement to print the raw value of call_priority to the trace log.

// Example of what the LOG action might output if there's a hidden space
// Input: "high "
// Output: "high " != "high" -> False

Also, ensure you’re using the correct variable scope. If call_priority is set on the contact level, make sure you’re referencing it as contact.attributes.call_priority and not just call_priority, depending on how your previous actions have defined the scope. It’s a tedious process, but tracing the variable through each step usually reveals the mismatch. I’d also recommend checking the IVR configuration to ensure it’s sending the value exactly as you expect, rather than relying on Studio to clean it up downstream.

might want to try using the == operator directly on the attribute instead of assigning it first. Studio handles the comparison natively and skips the extra step.

{
 "condition": "call_priority == 'high'"
}