Skip to main content
Level 2
Sep 8, 2025 8:48 PM UTC
Solved

Velocity Script Help

Hi - 

 

I'm currently working on a nurture targeting MQLs who have stopped responding to our BDRs. The emails will come from their BDR, but we are having a hard time filling out the From name and the signature. We have an sfdc custom object that accurately pulls in the contact's BDR email address (so reply-to and sender email is accurate) but we do not have a reliable field to pull in the contact's BDR Owner's name (From Name).

 

Does anyone have a velocity script to pull in the first and last name from the email address field? The structure of our BDRs emails is as follows: john.smith@company.com 

So in an ideal state the velocity script would pull in the first and last name like: John Smith

 

Thanks!

SanfordWhiteman
SanfordWhitemanAccepted solution
User Group Leader
Sep 8, 2025 10:36 PM UTC

What do you do if someone uses their middle name or initial? What about hyphenated first or last names?

 

In other words, is it possible with 100% accuracy to determine the correct values and correct case of the person’s First and Last from their Email?

4 replies

SanfordWhiteman
User Group Leader
SanfordWhitemanUser Group LeaderAccepted solution
User Group Leader
Sep 8, 2025 10:36 PM UTC

What do you do if someone uses their middle name or initial? What about hyphenated first or last names?

 

In other words, is it possible with 100% accuracy to determine the correct values and correct case of the person’s First and Last from their Email?

Translate
Level 2
Sep 11, 2025 4:18 PM UTC

Yes this is a small subset and with 100% accuracy all of the emails are transferable to the correct First and Last name form the email.

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Sep 11, 2025 8:35 PM UTC

Replacing $lead.YourEmailField with whatever the Velocity object/field name is for your BDR email:

#set( $emailField = $lead.YourEmailField ) #set( $lhs = $emailField.substring(0,$emailField.lastIndexOf("@")) ) #set( $lhsParts = $lhs.split("\.") ) #set( $impliedFirstName = $lhsParts[0] ) #set( $impliedLastName = $lhsParts[$math.sub($lhsParts.size(),1)] ) #set( $displayName = $display.capitalize($impliedFirstName.toLowerCase()) + " " + $display.capitalize($impliedLastName.toLowerCase()) ) ${displayName}

 

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Sep 9, 2025 6:32 PM UTC

@juleary324 please update based on my questions.

 

I don’t want to contribute code that doesn’t cover these edge cases.  Do you really mean it’s as easy as “split on the period, take the first and final item from the resulting array and make them First and Last respectively, and change the first letter of each to uppercase”?

Translate