SOLVED

Returning Most Recently Updated Custom Object

Go to solution
Wyatt_Bales4
Level 4

Returning Most Recently Updated Custom Object

I briefly touched on this with Sanford Whiteman​'s help onSorting a Marketo Custom Object with Velocity​ but we're now looking for a work-around due to Marketo not supporting $Trigger functionality on updated custom objects.

Trigger Campaign: Send email containing login details when an API call either adds the Contact to or Updates a Marketo custom object

Email Script: Only return the $Object.Username associated with the most recently updated row in the custom object

We can either reference the Last Modified Date (which is pull from the original data source) or the Marketo Updated At field. I'm assuming we would do a sort and pick the most recent value from either field.

Does anyone have any example scripts we could pull from? Appreciate the help in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Returning Most Recently Updated Custom Object

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Returning Most Recently Updated Custom Object

Have you seen this older blog post, Wyatt? Velocitip: Find the interesting object in Trigger and Batch modes

Wyatt_Bales4
Level 4

Re: Returning Most Recently Updated Custom Object

Thanks, Sanford Whiteman​. I was able to get it to work great. You can ignore my response on your forum. If the user has cookies disabled on that site, responses don't play nice because you have to login.

#if( $context.contains("TriggerObject") )

#set( $focusedObject = $TriggerObject )

$focusedObject.loginfield

#elseif( $context.contains("CustomObject_cList") )

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

$focusedObject.loginfield

#end