Skip to main content
Level 2
May 3, 2019
Question

Velocity Scripting to Display a Contacts Opportunity Owner

  • May 3, 2019
  • 2 replies
  • 4107 views

Hi All,

I am trying to create a email velocity script to just show the opportunity owners name in an email as a signature. So basically I am just trying to set the variable to be the actual value on the contacts record. I have tried (see below) but I keep getting an error. Can anyone tell me what I am doing wrong. Thanks.

#set ($opptname = ${OpportunityList.get(0).Oppty_Owner_Email__c})

#if($opptname.equals(""))

Account Rep

#else

$display.(Oppty_Owner_Email__c)

#end

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

2 replies

SanfordWhiteman
Level 10
May 3, 2019

Can you please highlight your code using the Syntax Highlighter?

https://s3.amazonaws.com/blog-images-teknkl-com/syntax_highlighter_v3.gif

Eoin_Lyons1
Level 2
August 1, 2019

Did you get this sorted @Eric Rosenberg‌? I'm curious about it too

SanfordWhiteman
Level 10
August 1, 2019

Eric's code has a clear error, but what are you trying?

Eoin_Lyons1
Level 2
August 2, 2019

I'm trying to create a token for a field called "Onboarding Coordinator", which lives on the Opportunity. I'm trying to put in rules that say if the value is blank, then default to "a team member", (by replicating code that you wrote here actually for first name). I will say that I'm a complete rookie at this and don't understand a lot of the functions yet.

#set( $OnboardingCoordinator = $OpportunityList.get(0).Onboarding_Coordinator_Name__c.trim() ) 
#if(
$OnboardingCoordinator.isEmpty() ||
$OnboardingCoordinator.matches(".*[0-9@._].*") ||
$OnboardingCoordinator.length() < 2 ||
$OnboardingCoordinator.indexOf(" ") == 1
)
a team member##
#else
#set( $OnboardingCoordinator = $OnboardingCoordinator.split(" +")[0] )
$display.capitalize($OnboardingCoordinator.toLowerCase())##
#end
‍‍‍‍‍‍‍‍‍‍‍‍

Here's your original, which works perfectly:

#set( $FirstName = $lead.FirstName.trim() ) 
#if(
$FirstName.isEmpty() ||
$FirstName.matches(".*[0-9@._].*") ||
$FirstName.length() < 2 ||
$FirstName.indexOf(" ") == 1
)
there##
#else
#set( $FirstName = $FirstName.split(" +")[0] )
$display.capitalize($FirstName.toLowerCase())##
#end‍‍‍‍‍‍‍‍‍‍‍‍