Attention: The Marketo Community will undergo scheduled maintenance on Tuesday, August 20th between 10-11 PM PDT. During this time, the Community and its content will not be accessible. We apologize for any inconvenience this may cause.
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
Can you please highlight your code using the Syntax Highlighter?
Did you get this sorted Eric Rosenberg? I'm curious about it too
Eric's code has a clear error, but what are you trying?
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
Looks fine, are you sure the field Onboarding_Coordinator_Name__c
is checked off in the tree in Script Editor?
Yes, it's checked off. I should add that when there's a first name in there, the script works. However, when the value is empty it shows as "$display.capitalize($OnboardingCoordinator.toLowerCase())
I don't think it's empty, it's null. Which is different. Custom object fields can be true null. Lead fields will be an empty string ("").
Account for this additional condition:
#set( $OnboardingCoordinator = $display.alt($OpportunityList.get(0).Onboarding_Coordinator_Name__c.trim(),"") )
Awesome - that worked! Thanks a lot for your help Sanford