Velocity for Custom Objects (Lead Source) | Community
Skip to main content
Feb 16, 2018 12:33 AM UTC
Solved

Velocity for Custom Objects (Lead Source)

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.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Feb 16, 2018 8:06 PM UTC

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

4 replies

SanfordWhiteman
Level 10
Feb 16, 2018 12:54 AM UTC

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.

Translate
Feb 16, 2018 4:13 PM UTC

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

Translate
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Feb 16, 2018 8:06 PM UTC

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

Translate