SOLVED

Dynamic Lists in an Email

Go to solution
Highlighted
Anonymous
Not applicable

Dynamic Lists in an Email

Hi - i'm looking to add dynamic lists of different lengths into an email. i used to be able to do this pretty easily in Exacttarget by putting in html in the user field such as  <ul><li>Doc 1</li><li>Doc2</li></ul> and wrapping it with ampscript to treat the value as html. I've tried to add that html as a user field value and adding the token in the email but it's not working.

Basically, I want the email to look like this:

You will receive the following documents

- Doc 1

- Doc 2

But it's currently coming out like this:

You will receive the following documents

Doc 1Doc 2

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Dynamic Lists in an Email

If $lead.docs is a semicolon-delimited list

#set( $docList = $lead.docs.split(";") )

#if( $docList.size() > 0 )

<ul>

<li>$display.list( $docList, "</li>\u000a<li>" )</li>

</ul>

#end

prints

<ul>

<li>Apple</li>

<li>Orange</li>

<li>Pear</li>

</ul>

View solution in original post

11 REPLIES 11
Highlighted
Level 6 - Champion Alumni

Re: Dynamic Lists in an Email

Hey Ziyu,

How many records does this process need to scale to? And is the number of lists in the email identical for all that you will send the email to?

Initial thoughts including adding the code you referenced directly in the email and only token the link to the list you need. I'd also recommend using folder or program tokens to reference the list URLs as opposed to using a custom field as that process wont scale overtime and both can accomplish the same goal (assuming you can build 1 email for each segment).

So again, i recommend putting all your code into the HTML of the email itself and use folder or program tokens to reference the lists themselves. Maybe Sanford Whiteman​ can speak more to using code in person tokens, but just feels funky and have to believe there is another way around this that is smoother.

Sincerely,

Keith Nyberg

Highlighted
Level 6 - Champion Alumni

Re: Dynamic Lists in an Email

Another approach would be to make a snippet that is dynamic and include that in your email. You'd need a segmentation built for this, but could suffice depending on how frequently this same process is executed/consistent to previous times.

Highlighted
Anonymous
Not applicable

Re: Dynamic Lists in an Email

I have different list sizes for over 100k leads. I'm not familiar with folder or program tokens. Can you explain further?

Highlighted
Level 6 - Champion Alumni

Re: Dynamic Lists in an Email

Hey Ziyu,

You can read about program/folder tokens in this article: Understanding My Tokens in a Program - Marketo Docs - Product Documentation

Again, my recommendation is to upload each list into the design studio so you get download links. From there, you can create a "Text" token in the setup tab of the program that will be sending these emails. 1 text token for each list with the link as the token value.

From there you can make your email dynamic based on a segmentation and write the copy for each group. Links to each list can be referenced as tokens to use in multiple places through out the dynamic email. SO you're sending 1 email, dynamic by segment, and each segment sees only the lists they need. Don't even need tokens if the lists are only used 1 time for each group.

That make sense? Open to other users chiming in on other clever ways to solve this, but feel this approach works depending on how many segments/lists there are.

Highlighted
Anonymous
Not applicable

Re: Dynamic Lists in an Email

that makes sense but my lists are by client/lead and i have over 100k clients with a unique list of items for each. does that mean i would have to make 100k tokens? The lists are basically as unique as a client's "email" or "first name" which is why I was trying to do it using a field name because it's according to the individual client, not a particular segment.

Highlighted
Level 10 - Community Moderator

Re: Dynamic Lists in an Email

... and based on this last update you definitely should be using Velocity.

Store the items in some neutral list form (like semicolon-delimited).  Then split() the string and output it as an HTML <ul>.

Highlighted
Level 10 - Community Moderator

Re: Dynamic Lists in an Email

You haven't explained in enough detail the actual source of these "lists." If every asset download program always has a distinct list, for all program members, then I wholly agree with Keith's suggestions.

If there's something that truly makes the list distinctive for every lead, then on the other hand I would use a lead field and output it using a Velocity ("email script") token. Velocity can output, verbatim, any HTML you want; it will not perform any escaping or "defanging" that you don't specifically tell it to.

Highlighted
Anonymous
Not applicable

Re: Dynamic Lists in an Email

Sorry if I wasn't clear. I have an email that I need to send to 100k unique clients/leads in a single program. This email needs to list out all the documents that a client will be receiving from us in the near future. Each client has a unique list of documents. You can basically think of the documents/list as a field variable that is unique to the user.  I am currently using the field method but am unable to output it as a list, it just outputs as text.

It sounds like the velocity script might be the best way to do this. Do you have documentation on how to use Velocity to output a lead field as html?

Highlighted
Level 10 - Community Moderator

Re: Dynamic Lists in an Email

If $lead.docs is a semicolon-delimited list

#set( $docList = $lead.docs.split(";") )

#if( $docList.size() > 0 )

<ul>

<li>$display.list( $docList, "</li>\u000a<li>" )</li>

</ul>

#end

prints

<ul>

<li>Apple</li>

<li>Orange</li>

<li>Pear</li>

</ul>

View solution in original post