title: How to make a reverse foreach search in velocity script?
body: <p>Marketo has a limit of 10 most recent opportunities that are searchable, and unfortunately we have a good number of users with more than 10 opportunities. </p>
  
  <p>It appears the foreach loop starts at the least recently updated opportunity, and works its way up the list to the most recently update opportunity. The issue here is that when they have more than 10, the script can't access those opportunities that are the most recently updated. We could get around this by reversing the order the script searches the opportunity list (by reversing the foreach). </p>
  
  <p>This is is the setup we have now (the script looks for a set of conditions within an opportunity, if it doesn't find them it looks for a different set, and so on). </p>
  
  <pre><code>#set($stip_guid = ${StipList.get(0).stip_opp_guid})
  
  #foreach($opportunity in $OpportunityList)
  #if($opportunity.o_opportunity_guid == $stip_guid &amp;&amp; $opportunity.o_clear_to_close_date)
  Display Unique Copy A
  #break
  #elseif($opportunity.o_opportunity_guid == $stip_guid &amp;&amp; $opportunity.o_sent_to_underwriting)
  Display Unique Copy B
  #break
  #elseif($opportunity.o_opportunity_guid == $stip_guid &amp;&amp; $opportunity.o_processing_received)
  Display Unique Copy C
  #break
  #else
  Default Copy 
  #break#end#end
  </code></pre>