Troubleshooting - Targeting Most Recent Custom Object | Community
Skip to main content
Level 2
November 29, 2021
Question

Troubleshooting - Targeting Most Recent Custom Object

  • November 29, 2021
  • 2 replies
  • 3199 views

Hi @sanfordwhiteman (or anyone else who has expertise in this area, feel free to reply), I recently read through some community posts about targeting the most recent data in a custom object, including this post from 2018-2019: https://nation.marketo.com/t5/product-discussions/how-do-you-access-the-most-recent-item-in-a-custom-object/td-p/79211

 

I also read the TEKNKL blog post https://blog.teknkl.com/tip-switch-trigger-and-batch-object/

 

I came to the following Velocity Script, which I tested in the Preview of the email with a relevant contact record:

#set( $dataByMostRecent = $sorter.sort($PAD_Metrics_v2_cList,"pad_load_date:desc") )
#set( $latestDataDetails = $dataByMostRecent[0] )
${latestDataDetails.pad_industry_assessment_1}

I have both pad_industry_assessment_1 and pad_load_date checkboxed in the custom object tree.

 

However, the email does not populate the data from the contact record for that field (it should show Network Fundamentals as the most recent data field output)  - it just shows the written-out variable in the email: 

${latestDataDetails.pad_industry_assessment_1}

Any ideas what I am missing or where I went wrong? Thank you in advance, I know that it's probably a question you get often. 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jo_Pitts1
Community Advisor
Community Advisor
November 30, 2021

@dbassett-2 ,

I find that if Velocity is spitting out the variable as text, it means it isn't recognizing it as a variable.

 

Are you 100% sure you've got the casing and spelling right on variable name that you're outputting?

 

Can you paste in a screenshot showing the field names of the custom object?

 

Cheers

Level 2
November 30, 2021

  

SanfordWhiteman
Level 10
November 30, 2021

Please include the unsorted, original list

$PAD_Metrics_v2_cList

in the received email and post the output.

Level 2
November 30, 2021

Hi Sanford, I'm not sure I understand what you mean. Are you saying to paste

$PAD_Metrics_v2_cList

in the velocity script right before the variable? Seeking to understand what "include the original list in the received email" means. Thank you

Level 2
December 6, 2021

@sanfordwhiteman just following up for clarification on your previous reply when you get a chance. Thanks!