Velocity Script sorting on multiple characteristics
I am trying to write a Velocity Script that will populate a field from a custom object into an email. The logic in the script needs to identify the correct custom object to use. Specifically, I want the most recently updated record with a specific status. I tried using this code, but it did not always identify the correct custom object.
#set( $sortedList = $sorter.sort($masterOrder_cList,["status:asc","UpdatedAt:desc"]) )
${sortedList.get(0).COFieldName}
Any tips are appreciated.
What I really want to do is create a work around for the fact that trigger tokens do not work with the Custom Object is Updated trigger....so if you have any ideas on that front, I would also be interested.
Thank you!