You can't parse it this way because of the order in which scripts and tokens are executed.
What are you actually planning to do to the structured data w/Velocity? And why can't you do that as you make the Request Campaign API call?
Hi Sanford,
Request Campaign API just pass a string token {{my.lines}} which contains pipe separated order details
such as "Product Code | Product Description | Price".
I wish velocity script can read {{my.lines}} value and output formatted html.
Thanks,
Bang-Tai
You could update a {{lead.token}} (i.e. custom field) and pass it into Velocity -- at the cost of more API calls, though.
But if you're controlling the entire pipeline, why not do the parsing before passing the token? Surely your language can do it as well as VTL.
Our formatted Order Details HTML are very complex.
Because when retrieving from Opportunities or Custom Objects,
only the ten most recently updated objects of a type are loaded.
Do you think it is a good idea that we create a Custom Object "OrderMaster"
with one field "OrderLines" to hold pipe separated order details ?
Because when retrieving from Opportunities or Custom Objects,
only the ten most recently updated objects of a type are loaded.
True, but not clear what this has to do with the what we're talking about....
Our formatted Order Details HTML are very complex.
But what language are you using to make the API calls that can't transform the data on the client side? Heck, you could even use Velocity itself on the client if you're using Java, or another templating language if you're using .NET, JS, Ruby...
Do you think it is a good idea that we create a Custom Object "OrderMaster"
with one field "OrderLines" to hold pipe separated order details ?
You could, but that would take other API work to add the COs. I still don't understand why, if the order details are being pre-processed at all, you can't do the formatting before passing the {{my.token}}. I'm a huge fan of using Velocity to process structured data (particularly JSON) but if I'm creating a temporary token at runtime (as when you use Request/Schedule Campaign) I'd do the processing in the app.