Re: velocity script newbie - lowercase first initial

Nicholas_Manojl
Level 9

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.

SanfordWhiteman
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}...