Conditional First Name Token

Anonymous
Not applicable

Conditional First Name Token

Hi,

We have several leads in our SFDC with first name as [First Name] as a placeholder.  When using the first name token in the email, I don't want [First Name] to be visible. Instead, I want the default value to be visible.

Does anyone know how to do this?

Thanks in advance!

-Kelly


Tags (1)
16 REPLIES 16
Dory_Viscoglio
Level 10

Re: Conditional First Name Token

Hi Kelly, I think the easiest way is to have a separate version of the email, and in the flow steps of the campaign if first name is [First Name], then you send them the alternate version of the email. Another method would be using dynamic content and segments, but that is probably more trouble than it's worth if you don't already have these people segmented out.
Anonymous
Not applicable

Re: Conditional First Name Token

Thanks Dory for your quick reply!

I was hoping to use something like an IF statement/formula. It sounds like tokens doesn't have that functionality other than "default?" Is that correct?

If we used the alternative email, would we have to clone the original email and then just remove the token in that version?

I don't know much about dynamic content and segments. We are also trying to find a solution that isn't too complicated.

Thanks again for your help!
Anonymous
Not applicable

Re: Conditional First Name Token

Hi Kelly,

To pick up where Dory left off here, the short answer to your question is essentially "yes".  You would want to clone the version of your email using the first name token, then in the second version, simply remove the token.

The way tokens work is that they will either display the value in the Salesforce field that it is calling, or if the field is empty it will display the fallback/default value.

I would suggest you look into Dory's suggestion of using segmentation as well.  If [First Name] is widespread in your database, setting up a segment to separate out that value could save you lots of time from cloning emails in the long run.
Anonymous
Not applicable

Re: Conditional First Name Token

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

Scott_McKeighe2
Level 5

Re: Conditional First Name Token

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!

Anonymous
Not applicable

Re: Conditional First Name Token

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!

Grégoire_Miche2
Level 10

Re: Conditional First Name Token

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

SanfordWhiteman
Level 10 - Community Moderator

Re: Conditional First Name Token

#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.)

Grégoire_Miche2
Level 10

Re: Conditional First Name Token

And opening new threads also guarantees that many more people will see it, notice it and will be likely to provide an answer.

-Greg