Conditional First Name Token | Community
Skip to main content
August 21, 2014
Question

Conditional First Name Token

  • August 21, 2014
  • 5 replies
  • 5099 views
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


This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

Dory_Viscoglio
Level 10
August 21, 2014
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.
August 22, 2014
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!
August 22, 2014
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.
July 28, 2015

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 4
July 28, 2015

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!

December 21, 2016

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
December 21, 2016

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