SOLVED

Velocity for Custom Objects (Lead Source)

Go to solution
Anonymous
Not applicable

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity for Custom Objects (Lead Source)

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

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity for Custom Objects (Lead Source)

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.

Anonymous
Not applicable

Re: Velocity for Custom Objects (Lead Source)

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

SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity for Custom Objects (Lead Source)

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

Anonymous
Not applicable

Re: Velocity for Custom Objects (Lead Source)

Thank you, Sanford! I appreciate very much!

Shawn