Dynamic Lists in an Email | Community
Skip to main content
January 9, 2018
Solved

Dynamic Lists in an Email

  • January 9, 2018
  • 2 replies
  • 4839 views

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?

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 SanfordWhiteman

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?


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>

2 replies

January 9, 2018

Nevermind! please ignore me. I had the wrong capitalization for the field. Thanks so much for all your help!

keithnyberg
New Participant
January 9, 2018

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

keithnyberg
New Participant
January 9, 2018

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.