Velocity script to retrieve latest custom object field | Community
Skip to main content
January 22, 2018
Solved

Velocity script to retrieve latest custom object field

  • January 22, 2018
  • 1 reply
  • 3786 views

Hi all,

I am currently having trouble trying to retrieve the latest custom object added.

As an example,

When someone lists their vehicle onto our platform a custom object 'Vehicle' is attached to the lead with a Listing ID.

I want to get that ID to use in a link in the email.

However I need it to return the latest custom object listing ID.

From researching i see that something like this will work, however I am trying to fit mine into it.

I am finding it difficult to fit it in ${Listing_cList.get(0).listingID}

  1. #if( $Listing && !$Listing.isEmpty() ) 
  2. #set( $firstItem = $Listing[0] ) 
  3. #set( $lastItem = $[$math.sub($Listing.size(),1)] ) 
  4. #end 

Thanks for your time and effort to read through

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

This code makes little sense, I must say. $Listing is not the name of your list of Listings and wishing won't make it so.

Please read this post: http://blog.teknkl.com/tip-switch-trigger-and-batch-object/

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 22, 2018

This code makes little sense, I must say. $Listing is not the name of your list of Listings and wishing won't make it so.

Please read this post: http://blog.teknkl.com/tip-switch-trigger-and-batch-object/

January 22, 2018

Hi there,

Sorry i should have clarified, that was just an example 'Listings' does not exist.

It's okay, thank you for that post! I will try to figure it out ^_^

Shayla_McKnight
New Participant
January 25, 2018

Hey Andrew,

Curious if you found your answer. I tried velocity scripting yesterday to pull the most recent order number from a custom object and it worked for me. The only thing I see missing from your velocity scripting below is the variable you want it to return. For example with my scripting I wanted order number so right below #end I put $lastItem.OrderNumber. Let me know if that helps.