Velocity Scripting to Display a Contacts Opportunity Owner | Community
Skip to main content
Level 2
May 3, 2019 5:55 PM UTC
Question

Velocity Scripting to Display a Contacts Opportunity Owner

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.

8 replies

Eoin_Lyons1
Level 2
Aug 1, 2019 9:12 PM UTC

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

Translate
SanfordWhiteman
Level 10
Aug 1, 2019 10:42 PM UTC

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

Translate
Eoin_Lyons1
Level 2
Aug 2, 2019 2:52 AM UTC

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‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Translate
SanfordWhiteman
Level 10
May 3, 2019 6:08 PM UTC

Can you please highlight your code using the Syntax Highlighter?

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

Translate