SOLVED

Strip email domain from email address with Velocity

Go to solution
Anonymous
Not applicable

Strip email domain from email address with Velocity

Hi all - I'm looking to strip the email domain from a record's email address as a placeholder for Company Name. I figure I can do this with an email script token, but I'm having some trouble finding any examples to work off of. Any ideas?

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Strip email domain from email address with Velocity

Josh doesn't like Velocity today.

#set( $domainMatcher = $lead.Email.split("^.*@") )

#if( !$lead.Company.isEmpty() )

Real Company field: ${lead.Company}

#elseif( $domainMatcher.size() > 1 )

Synthetic Company from Email: $domainMatcher[1]

#else

No Company available.

#end

This'll get you what you're describing -- just realize that if someone uses a personal email address their employer isn't "gmail.com."

View solution in original post

2 REPLIES 2
Josh_Hill13
Level 10 - Champion Alumni

Re: Strip email domain from email address with Velocity

at the form fill level or when you send an email with a token?

Form Fill=use jquery

Token Rendering = use a process outside of marketo to parse this when Company IS EMPTY.

SanfordWhiteman
Level 10 - Community Moderator

Re: Strip email domain from email address with Velocity

Josh doesn't like Velocity today.

#set( $domainMatcher = $lead.Email.split("^.*@") )

#if( !$lead.Company.isEmpty() )

Real Company field: ${lead.Company}

#elseif( $domainMatcher.size() > 1 )

Synthetic Company from Email: $domainMatcher[1]

#else

No Company available.

#end

This'll get you what you're describing -- just realize that if someone uses a personal email address their employer isn't "gmail.com."

View solution in original post