Skip to main content
Level 1
Dec 8, 2020 8:06 PM UTC
Question

Velocity tokens conditonal scripting logic to display content based on having product subscription

I'm creating a series of tokens so we can start using one email asset for several products. The token I am having trouble with is setting up several content blocks and displaying one if a lead has an active subscription to a qualifying product. It's approved when I place it inside the email, but when "previewing by list or person" nothing is being output. Here is the code I'm currently using in my token: 

 

#if( $zuoraSubscription.status == "Active" ) #if( $zuoraSubscription.productName == "SOH" ) block of content for SOH here. #elseif( $zuoraSubscription.productName == "WCA" ) block of content for WCA here. #elseif( $zuoraSubscription.productName == "TPE" ) block of content for TPE here. #end #elseif( $zuoraSubscription.isEmpty() ) You have no active subscriptions. #end
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
User Group Leader
User Group Leader
Dec 9, 2020 2:18 AM UTC

Not really enough info here, but at a fundamental level you shouldn't be using the == operator but rather .equals().

#if( $zuoraSubscription.status.equals("Active") ) #if( $zuoraSubscription.productName.equals("SOH") ) block of content for SOH here. #elseif( $zuoraSubscription.productName.equals("WCA") ) block of content for WCA here. #elseif( $zuoraSubscription.productName.equals("TPE") ) block of content for TPE here. #end #elseif( $zuoraSubscription.isEmpty() ) You have no active subscriptions. #end

 

This condition

$zuoraSubscription.isEmpty()

doesn't make much sense, as the Map itself will never be empty in Marketo.

 

If you're not seeing any output at all, consider the cases that aren't covered by your conditions.

Translate