Velocity Scripting not Rendering | Adobe Higher Education
Skip to main content
Level 2
September 18, 2019
Fråga

Velocity Scripting not Rendering

  • September 18, 2019
  • 1 svar
  • 5140 visningar

Hello,

I am automating emails in a Smart Campaign that is utilizing Velocity Scripted Tokens that are being populated with fields from a Custom Object. I have been running this campaign since June and just realized that about 25% of the recipients seem to be getting errors with the tokens when I look in preview mode. It is strange because it is working for the majority of the recipients but not the 25%. I looked at their custom object to insure the fields were populated, and they are. I am not sure if this is an actual error, or if it is just something wrong with Marketo's Preview Instance.

I've attached screenshots to show when the tokens work, and when I get an error. Any explanation?

Det här ämnet har stängts för svar.

1 svar

SanfordWhiteman
Level 10
September 18, 2019

Please move the thread to Products‌. Move link will be at the right. This isn't a support space.

You also need to provide (highlighted) code, dumps of your object data, and examples of the errors -- there isn't enough to go on here.

walsjamSkribent
Level 2
September 18, 2019

Here is an example of one of the Tokens Scripting. I don't think it has to do with the scripting as it is working for a number of recipients, just not all.

#set($total = $number.currency(${jHIMPolicyFeed_cList.get(0).vitalityRefundAmount}))
#set($stringLength = $total.length() - 0)
#set($totalb = $total.substring(0,$stringLength))
${totalb}

SanfordWhiteman
Level 10
September 18, 2019

Please highlight the code using the Advanced Editor's syntax highlighter, like so:

Select Java as the language, as it's closest to Velocity.

Your code, as far as I can read it without highlighting, depends on:

  • $jHIMPolicyFeed_cList being non-empty
  • the first item in $jHIMPolicyFeed_cList having a non-empty, non-null property vitalityRefundAmount

Ensure those conditions are met (by dumping the object list) when the output doesn't match your goals.

It's vanishingly unlikely that the problem is with the Velocity engine as opposed to your code + data.