CXone Studio: ASSIGN action failing to update variable for downstream IF check

I’m trying to replicate some logic we currently handle in our Kotlin Android app directly inside CXone Studio. The goal is simple: check if a custom attribute exists, set a flag, and route based on that flag.

The problem is the IF action seems to be evaluating the variable before the ASSIGN action actually commits the value. Or maybe I’m misunderstanding the execution order in the flow.

Here is the snippet:

  1. ASSIGN Action: target_variable = “is_priority”
  • Value: IF(GET("custom_attributes.priority_level") == "HIGH", "true", "false")
  1. IF Action: Condition: target_variable equals "true"
  • True Path: Route to Premium Queue
  • False Path: Route to Standard Queue

When I trace the call in the logs, the custom_attributes.priority_level is definitely “HIGH”. The ASSIGN action logs show it setting target_variable to “true”. But the IF action consistently takes the False path.

I’ve tried adding a WAIT action for 1 second between them, but that feels like a hack. Is there a specific way to force the variable state to persist before the next node evaluates? The documentation is pretty sparse on variable scoping within the same flow step.

Studio processes actions sequentially, but the IF block might be referencing a stale snapshot if the variable type isn’t explicitly set. Make sure the ASSIGN target is defined as a String or Boolean in the flow context, not just a raw value. If you’re using the legacy syntax, try forcing a refresh by adding a small delay or using a Set Variable action instead of ASSIGN. Here’s how the assignment should look:

{
 "actionType": "setVariable",
 "variableName": "crmFlag",
 "value": "{{customAttributes.crmId}}"
}

Check the variable scope in the IF condition. It needs to match exactly.