Velocity Script referencing multiple custom objects

Douglas_Meierdi
Level 2

I'm sending an email to new customers alerting them to the fact that they have job proposals and linking them to their posted job.

The smart campaign is:

  • Smart List
    • Trigger: Added to Event - Event name is job_posted
    • Filter: Has Job - Is true AND Current status is Open AND Type is Enterprise
  • Flow
    • Wait 2 Days
    • Send Email

Email Copy

"Hello,

I just wanted to remind you that you have attorney proposals for your job, {{my.TriggerENTJobTitleLink:default=edit me}}, waiting to be reviewed. Please take a look at the attorneys we’ve sourced for you."

The Token is:

#set($url = "www.upcounsel.com/job/proposals/${TriggerObject.jobid}")

#foreach($job in $jobList)

#if ($job.ucid == $TriggerObject.jobId)

    <a href="https://${url}" style="font-family: Helvetica;">$job.jobTitle</a>

    #end

#end

Yet when I run the campaign, nothing populates in the email and it looks like:

"Hello,

I just wanted to remind you that you have attorney proposals for your job, , waiting to be reviewed. Please take a look at the attorneys we’ve sourced for you."

What have I written wrong in the Velocity Script?

3 REPLIES 3
Nicholas_Manojl
Level 9

"Yet when I run the campaign, nothing populates..."

How are you running the campaign? I've found the Send Sample and selecting the trigger doesn't always populate the trigger object.

SanfordWhiteman
Level 10 - Community Moderator

+1, never test Velocity from a Send Sample.

SanfordWhiteman
Level 10 - Community Moderator

I'd need to see more information, like the shape of $TriggerObject itself, since if you have an error in the properties there wouldn't be any output. Can you output $TriggerObject and each $job in $jobList (on their own, no conditions). and show the result? Also, syntax highlighting is recommended...