Can you capitalize lead name token in email? | Community
Skip to main content
January 23, 2015
Solved

Can you capitalize lead name token in email?

  • January 23, 2015
  • 10 replies
  • 10566 views
If a lead enters their name in lowercase (john doe), how can I capitalize that token in an email (John Doe)? Is this something that can be fixed in form settings or should it be fixed in the HTML? I'm currently trying to fix it (unsuccessfully) in the HTML using the following:
<p><span class="text-transform:capitalize">Hey {{lead.First Name:default=there}}</span>,</p>

I have no coding background, so the HTML could be wrong. Any help is greatly appreciated!
 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman
@Tyler G also, the correct CSS would be 

style="text-transform: capitalize;"

However, this will be rendered in Outlook Web Access as if you used 'uppercase' (don't ask me why -- 'capitalize' has no kind of security implication I can think of).  By contrast, it works in Gmail.  YMMV.

 

10 replies

Kristen_Malkov1
Level 7
January 24, 2015

If you can do this, I'd love to know! 

Otherwise, I tend to take the time to standardize data using CRM fusion in Salesforce. 

Justin_Cooperm2
Level 10
January 24, 2015
It's Friday afternoon so I'll help you out!

You can use basic Java string manipulation in an Email Script token to do this. In your email program, click the "My Tokens" tab. Create a new Email Script token and name it what you'd like. In the script, enter:

#set($name = ${lead.FirstName})
$name.substring(0,1).toUpperCase()$name.substring(1).toLowerCase()


Note: Make sure you check the "First Name" checkbox in the right-hand tree under "Lead"!

Save the token and in your email asset, reference it as {{my.TokenName:default=Friend}} anywhere you like. It will output the first name of the lead with the first letter capitalized!

Email Scripts are your friend! Happy Marketing!
 
Noah_Wong1
Level 3
January 27, 2017

I keep getting this error message:

An error occurred when procesing the email Rendered_Email_Velocity_Error_Area_?!

Invocation of method 'substring' in class java.lang.String threw exception java.lang.StringIndexOutOfBoundsException: String index out of range: 1 near

Any thoughts?

Justin_Cooperm2
Level 10
January 27, 2017

Did you check the checkbox on the right side of the velocity script and does the lead have a first name?

January 24, 2015
Justin, thank so much, I've been trying to figure this one out. I'll try it.
cheers,
Josh_Hill13
Level 10
January 24, 2015
I'd setup a data cleaning system as Kristen suggests. I like the scripting idea, but you really should have some bot running in your CRM to fix this sort of thing.

But honestly, I'm never offended if that happens - because it was me who did the lowercase ;)
SanfordWhiteman
Level 10
January 26, 2015
I second Josh: if I lazily entered my name, it can even feel more intimate to have it left as-is.

Moreover, if this is lead-entered data, they know best how to spell their name.  You probably won't go wrong by capitalizing the first name (ignoring for the moment for the fact that the "first' name presented is the family name in some cultures).  But you can't just go capitalizing last names like "van Helsing" or "de la Fuente"!  Then you just seem culturally ignorant.  A data cleaning system can apply intelligence to this process, but it is not guaranteed.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
January 26, 2015
@Tyler G also, the correct CSS would be 

style="text-transform: capitalize;"

However, this will be rendered in Outlook Web Access as if you used 'uppercase' (don't ask me why -- 'capitalize' has no kind of security implication I can think of).  By contrast, it works in Gmail.  YMMV.

 
January 26, 2015
I like the way Aweber handles this, as it would be suitable to my ultimate goal. What Aweber does is allow you to select the token which runs the script to normalize title case on First Name, Last Name or FirstName/LastName in the asset you place the token within. That would work well for my requirement.

 
SanfordWhiteman
Level 10
January 26, 2015
Before taking the risk of culturally inappropriate "fixup" I suggest everybody read this comment from a person who understands the issues:

Quote:
French, German, and Dutch surnames among others may have prefixes like
"von", "de", and "van".  These may be separable ("van der Steen" is
alphabetized under "S") or an inherent part of the name, in which case
they are generally capitalized.  Getting this wrong may be insulting or
confusing.
January 26, 2015
Thank you for all the input and helpful responses. I'm glad to see I'm not the only one with this question!

The CSS fix suggested by Sanford fixed this for me, however I'll have to look into the Outlook issue.

I'm using this for an autoresponder in an engagement program (thus looking for a more real-time solution) and want it to look more "personal" and less like an automatic canned response. I'm looking into Justin's response too, however I can't seem to find email scripts in the Tokens. We are currently using Spark which might be the issue. 

As for the cultural issues, we are only using first names so hopefully this doesn't become an issue. It's good to keep in mind though. It's never good to insult potential customers with our first interaction!
SanfordWhiteman
Level 10
January 26, 2015
@Tyler I think you're right, Spark doesn't include "Advanced dynamic content."