Re: Help with Velocity Script - Custom Field in Salesforce

Anonymous
Not applicable

Help with Velocity Script - Custom Field in Salesforce

Hi,

I'm setting up a nurture campaign for reviving old leads in our database. The program is set up such that emails are coming directly from lead owners. As a precaution, I want the emails to come "from" and "reply to" our sales rep's secondary email address. The reason being, some of these old leads are really old, and it's possible their emails aren't active anymore so we want to mitigate any potential of impacting our domain's reputation.

I want to create a token that contains an email script that's able to reference the lead owner's secondary email address. I have a custom field set up in Salesforce that contains the rep's secondary email address on every lead record they own, and this custom field is synced to Marketo.

I want it to function exactly how the {lead.Lead_Owner_Email_Address} token functions, simply with a secondary email address.

Here's where I'm getting stuck:

1) I haven't found a successful script that references the custom field I set up in Salesforce on the lead's record. I tried the script below, which did not work.

#set {${lead.salesOwnerEmailAddress2}

#end

2) I also tried using a different approach, where I'd define the exact email address, based on the lead owner's name in Salesforce in the script instead of relying on what's populated in the Salesforce field:

#if(${lead.Lead_Owner_First_Name}} == "Farron")

  ##if lead is owned by Farron

  #set(${lead.salesOwnerEmailAddress2} = "farron@meetbench.com,")

    #end

   

The idea being that I would use a token that references this script in the "from" and "reply to" section of the email.

If you have any insight, I would really appreciate it.

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Help with Velocity Script - Custom Field in Salesforce

I don't see the need for Velocity here. What are the conditions under which the output would change from the raw output of {{lead.salesOwnerEmailAddress2}} if that field is already on the lead?

Darrell_Alfons2
Level 10 - Champion Alumni

Re: Help with Velocity Script - Custom Field in Salesforce

Agree with Sanford, we had a "Secondary Account Owner" field as well as a "Secondary Account Owner Email Address" and used that as a token for sender email address and reply to address.