SOLVED

Email Velocity Scripting for Opportunity Account Owner Info

Go to solution
chriszeng
Level 2

Email Velocity Scripting for Opportunity Account Owner Info

Hello! I'm trying to use Opportunity level data within my emails to let my contacts know who their Account Owner is. The trigger for the email campaign is based on if the Opportunity is updated to a new stage and the Account Owner information is not empty. 

 

For the email script, I only have the below right now by pulling in the fields and checking them off. I don't really need anything other than the info from the fields for the specific triggered opp. When previewing a sample record with this info populated (even those with just one opp), I'm not seeing anything come through. Sample view of what I'm seeing in Marketo:

 

Edit Script Token

1 ${OpportunityList.get(0).Account_Owner_Name}
2 ${OpportunityList.get(0).Account_Owner_Email}
3 ${OpportunityList.get(0).Account_Owner_Phone}

 

In an ideal state, I'd love to show it in this format for only the opp related to the trigger event which would be the latest opp:

Account Owner Name: [Account Owner Name field from the Opp level] and if empty, show nothing

Account Owner Email: [Account Owner Email field from the Opp level] and if empty, show nothing

Account Owner Phone: [Account Owner Phone field from the Opp level] and if empty, show nothing

 

Appreciate any eyes or help on this. Thank you!

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Email Velocity Scripting for Opportunity Account Owner Info

5 REPLIES 5
Phillip_Wild
Level 10

Re: Email Velocity Scripting for Opportunity Account Owner Info

Hi @chriszeng ,

 

At first glance, what you have will spit out the Account Owner details for the latest opportunity for that person. As long as the relevant fields are checked off on the right hand panel, and you are previewing the email based on a person that does indeed have an Opportunity where those details are filled in, you should see values there. I'm guessing you also dragged in the field name from the right, so there are no syntax errors? Since it's such a simple script there isn't much that can be checked besides those points...

 

If you'd like to show those fields only if there is a value, use something like this:

 

#if ( $OpportunityList.get(0).Account_Owner_Name.isEmpty() )
##show nothing
#else
Account Owner Name: $OpportunityList.get(0).Account_Owner_Name
#end

 

And replicate that for any other field you would like to use.

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Velocity Scripting for Opportunity Account Owner Info

chriszeng
Level 2

Re: Email Velocity Scripting for Opportunity Account Owner Info

Woohoo! Thanks Philip and Sanford! The preview wasn't working originally because of duplicates for the sample emails I was using which makes sense. The macro worked like a charm and I ended up with the below. Thanks both

 

#macro ( displayIfFilled $checkValue $fallbackValue )
#if( !($checkValue.isEmpty()) && !($checkValue == $display.get("0")) )
$!checkValue##
#else
$!fallbackValue##
#end
#end

#displayIfFilled(${OpportunityList.get(0).Account_Owner_Name}, "")<br />
#displayIfFilled(${OpportunityList.get(0).Account_Owner_Email}, "")<br />
#displayIfFilled(${OpportunityList.get(0).Account_Owner_Phone}, "")

 

madeline1
Level 1

Re: Email Velocity Scripting for Opportunity Account Owner Info

Hello,

Once you create a token for the opportunity account owner email-- how can you use it in the CC of email? I don't see it available on the local email or the email cc settings.

SanfordWhiteman
Level 10 - Community Moderator

Re: Email Velocity Scripting for Opportunity Account Owner Info

You can’t use it in the CC; that’s only for fields of the Email type that are at the person level.