The solution we use to get around this problem is a simple velocity email script token.
Essentially, this token looks at the value of the lead's first name, and if it's a default/blank value, we change the greeting to something generic, otherwise greet them by name.
Looks kind of like this:
#if (${lead.FirstName} == "")
Greetings from MyCompany!
#else
Hi ${lead.FirstName},
#end
Inside the email, you simply put the my.token for your email script in place of whatever salutation you had prior.
Another option, if you're not averse to adding fields to your instance, is to go with a Formula Field that evaluates the lead's first name.
Hope this helps!
This is great, Scott but I'm still having some trouble. If the first name field is empty, I don't want to have any greeting there at all. Any thoughts? Thanks in advance!
Hey Robin!
I would utilize Sanford Whiteman 's solution here. It's the most elegant and simple form of this IF/THEN velocity for salutation.
In our use case, we needed to be able to pivot the salutation based on the recipient's honorifics. So a Doctor would get "Hi Dr. Smith," whereas a staff member would get "Hi James,". To that end, you could really customize a salutation to whatever fits your business need, since you're evaluating a field's value to produce a desired output.
#if( !$lead.FirstName.isEmpty() )
Hello ${lead.FirstName}.
#end
(But really you should open a new thread instead of resuscitating an old one, since otherwise it'll never have a Correct answer.)
Thanks so much, Sanford. Am I doing something wrong? I'm getting this where is no first name. Happy Holidays, BTW!
Make sure First Name is selected in the treeview on the right side of the script editor.
You're a lifesaver!! Thanks so much!
Great! Mark as Correct when you get a chance?
Not a new thread so they can't mark as correct New threads are important.
Ah yes. I wouldn't bother opening this idea, but it would be cool if you could "fork" a thread to take ownership.
And opening new threads also guarantees that many more people will see it, notice it and will be likely to provide an answer.
-Greg
HI Robin,
With the Velocity scripting language, you can create the whole block of words and create a sophisticated logic with multiple if's or cases.
-Greg
Hi Kelly,
Sorry this is so late to the game, but you could ultimately use an email script to choose which field to send. In the velocity script, you could have a formula similar to what you are imagining that would use the first name only if it did not equal a certain value. If it did, then you can use another field.
Best,
Erik