CXone Studio ASSIGN and IF action failing to branch on custom field update

I’m trying to implement branching logic in a CXone Studio snippet. The goal is to check if a custom field is_premium is set to true, and if so, route to a specific queue. Otherwise, it should fall through to the default IVR.

Here is the snippet logic I’ve built:

ASSIGN: local.is_premium = contact.custom_attributes.is_premium
IF: local.is_premium == true
 THEN: Set queue to 'Premium Support'
ELSE:
 Continue to IVR

The issue is that the IF condition always evaluates to false, even when I manually set is_premium to true in the console before the call connects. I’ve verified the field exists and is populated.

I suspect the ASSIGN action might not be pulling the value correctly or there’s a type mismatch. The contact.custom_attributes.is_premium returns a string 'true' but the comparison uses a boolean true.

Should I be converting the string to a boolean first using another action? Or is there a specific way to handle string comparisons in Studio IF actions? I’ve tried local.is_premium == 'true' but it still fails to branch. Any ideas on what I’m missing?

The Studio ASSIGN action doesn’t always sync immediately with the IF condition in the same flow step. You’ll hit a timing issue where the local variable is null when the IF checks it. The documentation suggests using a small delay or ensuring the attribute exists before assignment. Try checking the custom attribute directly in the IF condition instead of assigning it first. It’s cleaner and avoids the race condition. Here’s the corrected logic:

IF: contact.custom_attributes.is_premium == "true"
 THEN: Set queue to 'Premium Support'
ELSE:
 Continue to IVR

Make sure the custom field is actually populated before this snippet runs. If it’s coming from a web form, verify the payload is reaching the engagement. Sometimes the attribute name has a typo. Check the JSON payload in the debug logs. If the field is missing, the IF will fail silently. You might want to add a fallback check for null values just in case. It’s a common gotcha in Studio flows.