How do you access the most recent item in a custom object?

Subscribe
SanfordWhiteman
Level 10 - Community Moderator

Re: How do you access the most recent item in a custom object?

Can you highlight your code as Java, please, using the Syntax Highlighter? Then we'll continue.

Maria_Riley
Level 1

Re: How do you access the most recent item in a custom object?

Hi Stanford, 

Below is the code that is working.

#set( $MembershipMostRecent = $sorter.sort($Membership__cList,"CreatedDate:desc") )  #set( $LatestMembershipDetails = $MembershipMostRecent[0] )  ${LatestMembershipDetails.Product_Name__c}  ‍‍‍‍

We would like to create something similar to reference the renewal price = ${Membership__cList.get(0).Membership_Renewal__cList.get(0).Sales_Price__c}

Thanks

SanfordWhiteman
Level 10 - Community Moderator

Re: How do you access the most recent item in a custom object?

(See my comment on your new thread.)