2 of 2 people found this helpful
Always test Velocity scripts with real emails, not samples!
The quickest way to debug ArrayList output is to output the full list. It will be automatically stringified:
Bear in mind that, in production, you definitely have to check to see if the index exists --
#if( $MarketoCustomObject__cList.size() > 2 ) ## .. stuff that expects index 2 to exist... #end
-- as accessing a nonexistent index is a fatal error in Velocity.
Thanks so much Sanford. Outputting the entire array is a great way to test! I should have thought of that
After some more testing, it seems that this error is purely related to the fact I was testing using "Send Sample Email" instead of Single Flow Actions. Lesson learnt! Phew. Very glad to see something this fundamental isn't broken in Marketo...