Marketing Community:
Do you know if I change the “Marketo Sync” Name in SFDC to be something else if it will Mess up the sync? We are doing a lot more personalisation for sign-offs in email’s and if a name/lead doesn’t have a lead owner it defaults to "marketo sync." Is there a work around here that's easy where I do not have to have magical developer powers??
Please move the thread to Products as it's Marketo-product-specific.
Like Dory said, Velocity is the way to go. Whether you consider this magical is up to you :
##----SET DEFAULT DISPLAY NAME----
#set( $defaultLeadOwnerFriendly = "Your Rep" )
##
##----SET SPECIFIC NAMES TO TREAT AS BLANK----
#set( $deFactoEmpty = [ "Marketo Sync", "Obsolete Owner" ] )
##
##----NO NEED TO EDIT BELOW THIS LINE!----
#set( $leadOwnerFriendly = "$!{lead.Lead_Owner_First_Name} $!{lead.Lead_Owner_Last_Name}" )
#set( $leadOwnerFriendly = $leadOwnerFriendly.trim() )
#if( $leadOwnerFriendly.isEmpty() || $deFactoEmpty.contains($leadOwnerFriendly) )
#set( $leadOwnerFriendly = $defaultLeadOwnerFriendly )
#end
${leadOwnerFriendly}
Sanford,
I have tried this code in the email script token:
#set( $defaultLeadOwnerFriendly = "The Team at eOriginal" )
#set( $deFactoEmpty = [ "Marketo Sync" ] )
#set( $leadOwnerFriendly = "$!{lead.Lead_Owner_First_Name} $!{lead.Lead_Owner_Last_Name}" )
#if( $leadOwnerFriendly.isEmpty() || $deFactoEmpty.contains("Marketo Sync") )
#set( $leadOwnerFriendly = $defaultLeadOwnerFriendly )
#end
${leadOwnerFriendly}
It is only returning the default "The Team at eOriginal"
even when the lead owner isn't empty and defacto empty is marketo. What am I doing wrong here? I've tested in a test smart campaign to myself as a lead with a sales rep as the owner, so the lead owner would not have been empty or marketo sync, can you please help?
<- where my script is, and token name
Hi Alison,
Sanford's line below is faulty (it's so rare that I can correct Sanford's code, that I am jumping on the occasion )
#if( $leadOwnerFriendly.isEmpty() || $deFactoEmpty.contains("Marketo Sync") )
should be
#if( $leadOwnerFriendly.isEmpty() || $leadOwnerFriendly.contains("Marketo Sync") )
or even better, since you are setting the defactoempty:
#if( $leadOwnerFriendly.isEmpty() || $leadOwnerFriendly.contains($deFactoEmpty) )
-Greg
Thank you very much testing now.
Can you tell me what the purpose of this line of code is: #set( $deFactoEmpty = [ "Marketo Sync" ] ) ?
Why do I need that? Can I just have the whole token written the way it is below to accomplish the same thing?
All I want to ensure is if the lead has marketo sync as the owner or owner is blank to use the default lead owner, otherwise it should be the assigned lead owner name...
#set( $defaultLeadOwnerFriendly = "The Team at eOriginal" )
#set( $leadOwnerFriendly = "$!{lead.Lead_Owner_First_Name} $!{lead.Lead_Owner_Last_Name}" )
#if( $leadOwnerFriendly.isEmpty() || $leadOwnerFriendly.contains("Marketo Sync") )
#set( $leadOwnerFriendly = $defaultLeadOwnerFriendly )
#end
${leadOwnerFriendly}
In fact, Sanford's code was not faulty (my bad), but the way you replaced "$deFactoEmpty.contains($leadOwnerFriendly))" with "$deFactoEmpty.contains("Marketo Sync"))" made it wrong as this is always true.
So, the line should be
#if( $leadOwnerFriendly.isEmpty() || $deFactoEmpty.contains($leadOwnerFriendly) )
Sorry Sanford for doubting of you
-Greg
Ha, I was about to issue a defense.
Yep, Allison, see where it says NO NEED TO EDIT BELOW THIS LINE? You edited below that line.
$deFactoEmpty is an array of all owner values that should be interpreted as empty (obselete values, placeholders, etc.). Those values, as well as true empty values, are replaced by whatever you set as $defaultLeadValueFriendly.
I'm Sorry I edited because I pasted in what you had above and it was still not returning the lead owner... here's how I edited the top part without editing your bottom code...
"Your Rep" I edited to show "The Team at eOriginal" as I wanted that to show when no lead owner was associated with record
Then "Marketo Sync", was the only thing I left in their because I was not sure what "obsolete owner" was/or should be replaced with. Also, do I pasted this in with your "##--- ---- " lines? Sorry I am completely new to this and have a strong right brain, but slow left one. 😉
Yes, include the ## (comment lines). Didn't expect that you'd edit them out.
You were right to set $defaultLeadOwnerFriendly to "The Team at eOriginal."
You can leave "Obsolete Owner" in the array of de facto empties or remove it.
If this still isn't working in your environment, then look extra-closely at the Lead Owner that you're trying to catch and replace. Is it really "Marketo Sync" (case sensitive, with no spaces)? Can you show a screenshot of the Lead Owner First Name and Lead Owner Last Name?
Lead owner record in Marketo:
Well, that looks right for the de facto empty ("Marketo Sync").
Are you saying it's also picking up other leads as being de facto empty? Can you show me a screenshot of those?
What I am saying is that when I place the exact code you have in the token, mmodified without Obsolete owner, and The Team at eOriginal in the default friendly, Its only returning the word: Sync
So email has:
contact us for more questions!
Sync
Should be:
contact us for more questions!
Andrew Kunkel
(as he is the lead owner of my record that I am testing to in salesforce) Now it is not even adding in the default "The team at eOriginal" ) I'll try and pull a screen shot.
Fixed the last line (wrong copy/paste) in my post.
-Greg
How do I move this to marketo products?
Also, where do I put the script code you wrote above?
There should be a "Move" link on the right nav bar when you edit the post.
Velocity ("Email Script") tokens are added, like the other {{my.token}} types like Text*, Rich Text/HTML, and Calendar tokens, at the Folder or Program level.
Then you reference them in your email by the token name: {{my.leadOwnerDetector}} for example.
* A Velocity token without any special code and just the one line "hello" is basically identical to the Text token "hello." It's with the addition of #set and #if conditions that Velo comes alive.
Hey Allison, this is a great use case for velocity scripting. You can use the lead owner name if it isn't Marketo Sync, and if it is Marketo Sync you can have it add a different value.