Velocity for Custom Objects (Lead Source) | Community
Skip to main content
February 16, 2018
Solved

Velocity for Custom Objects (Lead Source)

  • February 16, 2018
  • 1 reply
  • 2032 views

Hi Nation, I'm searching for a Velocity solution to get the most recent Lead Source when there is more than one. Using only ${leadSource_cList.get(0).source} does not get the most recent source on record but the initial one (when there is more than one source added to Lead over time).

Most grateful in advance,

Shawn

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

You should have an updatedAt field on your CO, so like so:

#if( !$leadSource__cList.isEmpty() )

#set( $mostRecentLeadSource = $sorter.sort( $leadSource__cList, "updatedAt:desc" )[0] )

Most recent is ${mostRecentLeadSource}

#else

No sources in list

#end

1 reply

SanfordWhiteman
New Participant
February 16, 2018

Please move this to Products​ to continue (Move link is at the right). This space isn't for support, it's for discussing the Champs incentive program itself.

February 16, 2018

Darn, sorry for that, moving now! Thank you!

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
February 16, 2018

You should have an updatedAt field on your CO, so like so:

#if( !$leadSource__cList.isEmpty() )

#set( $mostRecentLeadSource = $sorter.sort( $leadSource__cList, "updatedAt:desc" )[0] )

Most recent is ${mostRecentLeadSource}

#else

No sources in list

#end