Can you script a table inside of a custom token? | Community
Skip to main content
Level 2
September 12, 2018
Solved

Can you script a table inside of a custom token?

  • September 12, 2018
  • 1 reply
  • 6785 views

This thread started as a result of the outcome from this previous thread: How to get a token script to display information from Opportunity Object?

I am creating a template that includes several tables, which has tokens from the lead object, and needs tokens from the opportunity object. The number of tokens required exceeds 40 tokens - the limit in a given email.

My first workaround was to use formula fields, but discovered I can't use custom tokens created from the opportunity object in formula fields.

My next thought was to create a custom token with the content of the formula field - script a table and put all the needed fields within it. How would I go about having a velocity-scripted token recognize HTML, though? In our example case, let's say I want my one custom token to have the code for one table. The table has 10 rows and 4 columns. Half of my field values would be based on the lead object, while the other half are based on the opportunity object. How would I script to include the table with 20 tokens?

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Alex_Bridges3

You can DM me if we follow each other...


Marketo support gave me the official answer - I can't do it. Basically, if I'm attempting to display more than 60 "non-Marketo" fields (anything synced to an SFDC field; either on the opportunity object, or a custom SFDC field), it won't work. No workarounds. I brought up this thread and they said that if it's a standard Marketo field, it would work, but otherwise, there's no way. I'm not entirely sure I believe them, but they were pretty steadfast about it.

1 reply

SanfordWhiteman
Level 10
September 12, 2018

How would I go about having a velocity-scripted token recognize HTML, though? In our example case, let's say I have one table that has 10 rows and 4 columns. Half of my field values would be based on the lead object, while the other half are based on the opportunity object. The order of my field values isn't flexible, as our proof of concept was already approved in the order it's currently in.

Velocity doesn't need to "recognize" HTML, if you mean parsing HTML, in this case (VTL it does have HTML-escaping functions, though).

It sounds like you want to output an HTML <table> element and all of its child elements from Velocity, and it's perfectly suited for that.

Level 2
September 12, 2018

I scripted the tokens out, but I'm running into an issue where each table/token works fine on its own, but I seem to hit a limit where the Marketo previewer pukes. Is there a limit of some kind as far as the data it will display? I can get around 63 out of 94 field values to display, or 6 of my 9 tables put in before the previewer suddenly "can't connect." I tested each table one by one, and tried different combinations; each table individually works, and it breaks no matter which combination I use if I go beyond a certain number of field values. I even tried just making one "master token" with all the tables, but it broke too.

Rajesh_Talele13
Level 2
September 13, 2018

Hi Alex,

Did you only try in the 'preview' or did you actually send this email to yourself or a test contact. May be the renderer for the 'preview' functionality is 'limited' while actual email rendering while sending will work fine.

How about sending this email to a test lead and see if all the values are rendered.

Hope this helps..

Rajesh Talele