Using Velocity Script token in Email Alert to Trust Pilot
Hi Community,
I am working with our team to implement a very simple trigger-based email that includes a single Velocity script token.
The purpose of this email is to trigger a second email from Trust Pilot that grabs the data from the first email (sent by Marketo) and uses this to request an online review from the recipient.
This VS token looks for the most recent cruise booking opportunity on a contact record, grabs the booking id from the opportunity, and populates it in the email. The email then gets sent to Trust Pilot’s Automatic Feedback Service (AFS) via a Send Alert smart campaign flow step.
When I initially tested this using only my account, the token was populating just fine:

And the email successfully created a record in Trust Pilot that included my email address and the booking ID number. Plus I received an email from TP asking for a review:


However, when I tried to send the alert email via both a batch and trigger campaign, with multiple people qualifying (23 ppl), this resulted in multiple failures where the requests were received, but were not processed, resulting in no profile data coming through.

We can’t determine if this is due to an issue with the Velocity script tokens or if there is something else going on.
Does anyone have any experience with using TP’s AFS process?
Thank you!
Laura Kimball
Velocity Script code:
#**
* @version v1 2026-06-08
* @author Laura Kimball
* @requires-objects
* Opportunity ($OpportunityList)
* @requires-object-fields
* Opportunity.Item Type Key (itemTypeKey)
* Opportunity.Date (date)
* Opportunity.CRBK (cRBK)
*#
## Find the most recent cruise opportunity (itemTypeKey = "5")
## based on Opportunity.date
#if( $TriggerObject )
#set( $focusedOppty = $TriggerObject )
#else
#set( $focusedOppty = {} )
#set( $datedCruiseOpportunities = [] )
#foreach( $oppty in $OpportunityList )
#if( $oppty.itemTypeKey.equals(5) && !$display.alt($oppty.date,"").isEmpty() )
#set( $void = $datedCruiseOpportunities.add($oppty) )
#end
#end
#end
#set( $focusedOppty = $sorter.sort($datedCruiseOpportunities,"date:desc").get(0) )
## Output cRBK if present
#if( !$display.alt($focusedOppty.cRBK,"").isEmpty() )
${focusedOppty.cRBK}
#end