AnsweredAssumed Answered

How to use Velocity to grab newest entry in custom object?

Question asked by 16bb5463a0143aab4780ee36e5906dbc8ff65d81 on Mar 15, 2017
Latest reply on Mar 20, 2017 by 16bb5463a0143aab4780ee36e5906dbc8ff65d81

Hello fine humans of Marketo Nation!

 

I'm facing a bit of a quandary with our Velocity scripting, and could use your help.

 

Basically, my company is sending out appointment emails, which are triggered based on updates to the custom object. A customer could have multiple entries for the custom object.

 

Here's my issue: the emails are often spitting out old information, not the newest available. The script that's in there was around before I arrived, and was apparently implemented by a 3rd party that we no longer work with. From what I can tell, it's bunk, and is operating no differently than if we just had the basic info dragged over in the token script editor. I can include it if people would find it helpful, though honestly it looks like a mess and I can't make any sense of it.

 

My question to you: How do I get Marketo to pull the newest entry of a custom object? Most of the fields I'm working with are strings and one date. I've been trying to do the date field just to keep it simple, but no matter how I'm structuring it, it's spitting out the oldest date.

 

An example of what the basic script would be for the date token: ${appointment_cList.get(0).appointmentDate}

There's also IDs for appointmentTime and appointmentCode.

 

Any advice would be most appreciated!

Outcomes