AnsweredAssumed Answered

#foreach velocity question

Question asked by Daniela Puizina on Sep 18, 2019
Latest reply on Sep 19, 2019 by Daniela Puizina

Hi all,

I'm trying to create a script that says if a contact has an account owner of any of the stated emails (below), display html and if not display different html. However, when I try to test it, I get this error: 


Cannot get email content- <div>An error occurred when procesing the email Body! </div> <p>Encountered ") \n" near</p> <div><pre >#if( $accountowner.matches($email) ) </pre><pre > #set($foundMatch) </pre><pre class="x-form-item-label"> #break </pre><pre >#if($foundMatch)</pre><pre >correct html</pre></div>


One of our front-end engineers had helped me with it but he isn't familiar with velocity so I'm not sure if it's just a simple syntax error. Any ideas?


#set ($accountowner = "${lead.Account_Owner_Email_Address}") 
#set ($foundMatch = false)
#set( $outputByEmail = [
"" ]) 
#foreach( $email in $outputByEmail )
#if( $accountowner.matches($email) )           
correct html