Rayyis
Rayyis

Reputation: 28

marketo loop velocity script to display product interest for a Lead

I am trying to code an email velocity script in Marketo to list all ProductInterest a lead has in an email, we have a total of 125 products as a custom {{my.token}}.

I want the script to Display ONLY the $ProductName a Lead has if the $Type=Invested

ProductInterest is a custom object. ProductName and Type are sub parts of ProductInterest

custom object

a Lead can have any number of Products associated with his account I am only interested in products in which Lead has "Invested".

The end result I am looking at is,

Dear John Doe,

Based on your interest in products A,B,C,D...... we are sending you this email.

The scripted token needs to populate A,B,C,D....

Thanks for the help in advance....

I made this code,

#foreach ($ProductName in $ProductInterestList)
#if($ProductName.Type == "Invested")
<p><strong>$ProductName.ProductName</strong></p>
#end
#end

Problem with this solution is it is listing every product in the list and NOT the ones the lead is associated with which have Type as "Invested". Anyone help with this is much appreciated.

Please note I am a novice in Velocity scripting. Thank You

Upvotes: 0

Views: 416

Answers (1)

Rayyis
Rayyis

Reputation: 28

I figured it out, heres the code

#foreach ($ProductName in $ProductInterestList)
#if($ProductName.Type == "Invested")
<p><strong>$ProductName.ProductName</strong></p>
#end
#end

Upvotes: 0

Related Questions