Velocity Scripting Accessing all custom objects in a single event
In our instance in Marketo, we store purchased items inside of Custom Objects.
For some of the objects (we call Webinar Entitlements) we sent out a "Here is how to access your webinar" email that uses velocity scripting to pull the information from inside the Custom Object and populate it into the email. The email is triggered on the "Added to Custom Object" event, with a few additional constraints around the information inside the custom object.
The problem we have is that the scripting is strictly taking a value - we aren't using loops or conditionals and calling out the index position. So if someone purchases say, 3 webinars in one check-out, they will get 3 emails all with the information specific to the custom object in that 0 index position.
I'm working out with developers a way to send ONE email only populated with webinar information that they purchased that day / that singular check-out event. There is a way we can use conditionals and loops, however, our developers are asking if there is a way we simplify the script and access ONLY the objects of the event and populate based on event. So say I purchased 3 webinars in 2019. And on Jan 1 2020 I purchased 2 webinars in one check-out event. How would I go about writing the velocity scripting so the email only includes the custom objects added to my record on Jan 1. Is there a token that I can reference that pulls all entitlements added for that event of adding multiple custom objects?
Further, it would need to account for mixed media. Say I buy 1 book and 2 webinars - we would want to script to ONLY pull info from the Webinar Entitlement and exclude information from the "Book Entitlement".