SOLVED

Re: velocity script troubleshoot needed?

Go to solution
Anonymous
Not applicable

velocity script troubleshoot needed?

Hello community,

As I am working on my script, some weird things happened when I tested the same script. Yesterday it didn't work, and the $ showed up in the email. Today morning it worked just fine. And 10 minutes later it is not working and showing $ again. Anyone can tell me why it is so unreliable?

Here is my script (very simple)

#set ($propcompany = ${lead.Company})

#if($propcompany.equals("Unknown")||$propcompany.contains("?")||$propcompany.isEmpty())

What can your company unwrap this year?

#else

#set($greeting = $display.capitalize($propcompany))

#set($greetll = "What can $greeting unwrap this year?")

$greetll

#end

Anyone else experiencing similar behavior?

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: velocity script troubleshoot needed?

If you don't check off the Lead.Company in the tree, then that property will come in as null. Depending on your code, a null can end up going through the same path as an empty string ("").  So that can mask the underlying cause, but checking off the property in the right-hand tree is the real solution.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: velocity script not reliable?

Are you testing with the same exact lead, and have you tested with something other than the Company field (which has a specific behavior with CRM sync)? What do you mean that "$" is showing up? You mean in addition to the output? Please be precise about your expected and observed behavior, and test with another field that isn't so volatile.

Let's not spread the concept that Velocity is unreliable.  It's a venerable, open-source technology that Marketo wisely chose as their scripting language. If there's a post that has the words "not reliable" in the title, people will start to believe it regardless of the eventual findings.

Anonymous
Not applicable

Re: velocity script troubleshoot needed?

Thanks for the feedback I changed the subject.

Here is what I see in the actual email when using a lead that actually qualified to have the first part of the script (company name =Unknown).

What can $greeting unwrap this year?

Do you know what is causing this? Thank you!

SanfordWhiteman
Level 10 - Community Moderator

Re: velocity script troubleshoot needed?

Thanks for changing the thread subject!

When you simply output the raw

${lead.Company}

you see the literal text

Unknown

?

You made sure to include Lead.Company by clicking it off in the right-hand tree, right?

Anonymous
Not applicable

Re: velocity script troubleshoot needed?

When I changed it to:

#set ($propcompany = ${lead.Company})

#if($propcompany.equals("Unknown")||$propcompany.contains("?")||$propcompany.isEmpty())

What can your company unwrap this year?

#else

#set($greeting = $display.capitalize($propcompany))

#set($greetll = "What can ${greeting} unwrap this year?")

$propcompany

#end

I see $propcompany

and when I changed it to:

#set ($propcompany = ${lead.Company})

#if($propcompany.equals("Unknown")||$propcompany.contains("?")||$propcompany.isEmpty())

What can your company unwrap this year?

#else

#set($greeting = $display.capitalize($propcompany))

#set($greetll = "What can ${greeting} unwrap this year?")

${lead.Company}

#end

I see ${lead.Company}

Anonymous
Not applicable

Re: velocity script troubleshoot needed?

Oh I didn't click the company on the right hand side.....BUT how come it worked for once? That is a mistake of mine...

Li

SanfordWhiteman
Level 10 - Community Moderator

Re: velocity script troubleshoot needed?

If you don't check off the Lead.Company in the tree, then that property will come in as null. Depending on your code, a null can end up going through the same path as an empty string ("").  So that can mask the underlying cause, but checking off the property in the right-hand tree is the real solution.