velocity script newbie - lowercase first initial

Highlighted

Re: velocity script newbie - lowercase first initial

I tried that yesterday.. I think it went something like

$i = firstname.length - firstname.length

charAt(i)

But are you sure that's the issue - as above, I can send in an actual campaign, and the preview works. It is just the email approval and sample send that fails.

Highlighted
Level 10 - Community Moderator

Re: velocity script newbie - lowercase first initial

Yes, I'm quite sure that's the issue. That exception is thrown if you have a string of length 0 (which does not have a charAt(0)).

#if(!$lead.FirstName.isEmpty())

    #set($fi = $lead.FirstName.toLowerCase().charAt(0))

#end

Firstly, $!{fi}...