We're trying to use the foreach directive in Velocity to list all the Order Dates that a contact had have, over time.
For example, Joe Smith placed an order today and one yesterday, so in the email I want it to list out both dates. I've used this script:
<ul>
#foreach ($Program_Order in $Program_Order__cList)
<li>${Program_Order__cList.get(0).CreatedDate}</li>
#end
</ul>
But in the email outputs, it just lists out yesterday's date, twice. So it's recognizing that Joe has 2 order records attached to it, but only populating it with the first order's created date in the list. What am I missing in the script?
Thanks!
Solved! Go to Solution.
You keep getting the same index, so that's to be expected.
You want
<li>${Program_Order.CreatedDate}</li>
Please highlight your code using the Syntax Highlighter, then we'll continue.
thanks! I've edited the original post with the syntax highlighter, also below:
<ul>
#foreach ($Program_Order in $Program_Order__cList)
<li>${Program_Order__cList.get(0).CreatedDate}</li>
#end
</ul>
it works great now, thank you!!