Email Velocity Scripting for Opportunity Account Owner Info | Community
Skip to main content
Level 2
June 24, 2021
Solved

Email Velocity Scripting for Opportunity Account Owner Info

  • June 24, 2021
  • 1 reply
  • 4485 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Level 9
June 25, 2021

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
SanfordWhitemanAccepted solution
Level 10
June 25, 2021
chriszengAuthor
Level 2
June 25, 2021

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}, "")