Re: Email Script Causing Error

Anonymous
Not applicable

Email Script Causing Error

I have the following in an Email Script:

#foreach($opportunity in $OpportunityList)

    #if($opportunity.o_opportunity_type == "Home Loan")

        #if($opportunity.o_funded)

        <p>How Old: $date.whenIs( $opportunity.o_funded )</p>

        <p class="copy" style="margin: 0px;">$opportunity.o_owner_first_name $opportunity.o_owner_last_name</p>

        <p class="copy" style="margin: 0px;">NMLS #$opportunity.o_owner_nmls</p>

        <p class="copy" style="margin: 0px;">$opportunity.o_owner_phone ext. $opportunity.o_owner_extension</p>

        <p class="copy" style="margin: 0px;">${lead.lo_email}</p>

        #break

        #end

    #end

#end

When I add this token to an email and try to Send Sample Email to test it I get the following error message:

An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_?!

String index out of range: 19625

?

Has anyone experienced this and know what might be causing this?  We are using other similar email scripts that work fine and not sure why this one won't work.  Any help would be appreciated!  Thanks!

Jill

Tags (1)
4 REPLIES 4
Anonymous
Not applicable

Re: Email Script Causing Error

When you're using #if, you really should include the #else also. I suspect this might be the issue. Try something more like this:

#foreach($opportunity in $OpportunityList)

    #if($opportunity.o_opportunity_type == "Home Loan")

        #if($opportunity.o_funded)

        <p>How Old: $date.whenIs( $opportunity.o_funded )</p>

        <p class="copy" style="margin: 0px;">$opportunity.o_owner_first_name $opportunity.o_owner_last_name</p>

        <p class="copy" style="margin: 0px;">NMLS #$opportunity.o_owner_nmls</p>

        <p class="copy" style="margin: 0px;">$opportunity.o_owner_phone ext. $opportunity.o_owner_extension</p>

        <p class="copy" style="margin: 0px;">${lead.lo_email}</p>

        #break

        #else

        #end

    #else

    #end

#end

Stijn_Heijthuij
Level 7

Re: Email Script Causing Error

Jill,

Did Kristen answer your questions? In any case, you might want to try the 'formal' notation of Velocity in some cases. I suspect this bit might be throwing you off "NMLS #$opportunity.o_owner_nmls".

Kenny_Elkington
Marketo Employee

Re: Email Script Causing Error

Agreed.  I always use formal reference notation for text output even when it's not strictly necessary.  It's to easy for the parser to get confused.

Stijn_Heijthuij
Level 7

Re: Email Script Causing Error

Funny, I discovered the same thing recently. It doesn't really matter for setting and reading variables, but when you're displaying text, formal is the best practice.