Velocity Script Help | Community
Skip to main content
Level 2
September 8, 2025
Solved

Velocity Script Help

  • September 8, 2025
  • 2 replies
  • 472 views

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!

Best answer by SanfordWhiteman

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?

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
September 8, 2025

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?

Level 2
September 11, 2025

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.

SanfordWhiteman
Level 10
September 11, 2025

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}

 

SanfordWhiteman
Level 10
September 9, 2025

@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”?