AnsweredAssumed Answered

More than one Opportunity per Contact - Velocity Script

Question asked by Scott Springer on Nov 13, 2019
Latest reply on Dec 1, 2019 by Scott Springer

Dear Marketo Community,

 

We use tokens to generate notification emails for appointment bookings, which pulls from the Opportunities field mapping.

 

Our issue is that often a contact has multiple opportunities listed against it, and the current scripting logic we have is always pulling the "latest" opportunity linked to the contact - I believe this is associated with the get(0) function in the Velocity script.

 

The end result is that our customers are getting notifications for appointment bookings which is pulling reference information that is from the wrong opportunity (usually due to a cancelled or rescheduled booking)

 

Token examples

${display.alt($OpportunityList.get(0).sourceJobNumber,"")} 
${OpportunityList.get(0).Stage}

 

Is anyone aware of how to add a qualifier to the velocity script such that we can refine the criteria of how the token is being populated? We don't necessarily want the "latest", we want to specify criteria on how to match the Opportunity needed, in our case show the Job Number which has Opportunity Stage = "Confirmed". I imagine it's a combination of specifying this in the velocity script, but can't work it out.

 

Thanks for any pointers or suggested solutions for this challenge, we were thinking it may be a relatively common challenge, but could not find any mention of it.

 

Many thanks,

Scott

Outcomes