I’ve got a script that needs to hit different endpoints based on a custom attribute value. The logic seems sound, but the ASSIGN action keeps picking the wrong URL variable. It’s driving me nuts.
Here is the flow:
- Get Attribute action pulls
customer_tierfrom the contact’s profile. Value is eitherGOLDorSILVER. - IF action checks if
customer_tierequalsGOLD. - If true, ASSIGN sets
target_urltohttps://api.gold.com/data. Else, it setstarget_urltohttps://api.silver.com/data. - REST Proxy action uses
{{target_url}}as the endpoint.
The problem is target_url is always https://api.silver.com/data, even when the attribute is GOLD. I checked the debug logs. The IF condition evaluates to true. The branch logic is correct. But the variable doesn’t update.
I tried putting the ASSIGN in a separate block. Same result. I tried using the Set Variable action instead of ASSIGN. Still stuck on the else value. The variable scope is set to Session for both assignments.
Is there a known issue with IF/ELSE branching and variable assignment in the same block? Or am I missing something about how evaluates these expressions? The syntax looks fine:
IF {{customer_tier}} == "GOLD"
ASSIGN {{target_url}} = "https://api.gold.com/data"
ELSE
ASSIGN {{target_url}} = "https://api.silver.com/data"
The REST call fails with a 404 because it hits the silver endpoint for a gold customer. I need this to work for the production release tomorrow. Any ideas why the assignment isn’t sticking?