Tokens & Lists (Conditional Logic) | Community
Skip to main content
Level 2
November 15, 2016
Question

Tokens & Lists (Conditional Logic)

  • November 15, 2016
  • 5 replies
  • 5254 views

Marketo nation;  I am in need of help on email creation and variable/conditional token logic.  I have an email requirement that must allow for the following:

One of the following two options must be met in the content of the email body:

Option A: "My family has the following pets:  Dog, cat, fish, and lizard"

Option B: "My family has the following pets:

Dog
Cat
Fish
Lizard"

The problem however, is that there could be anywhere from 1-13 pets listed in this business case.  For example, leadA may have 3 pets, leadB may have 9 pets.  We've never been asked to build this level of "token-ization" in Marketo, nor do I know if it's possible.  In option A, we'd have no idea how to dynamically insert the "," value or the "and" value before the last variable.  Meanwhile, in option B, we' have no idea how to eliminate the line breaks if there are fewer than 9 pets.

Has anyone ever had to do this?  Essentially, we're sending an email to our customers letting them know which products they've signed up for. We're open to any/all ideas the nation may have.  Thanks in advance.

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

5 replies

SanfordWhiteman
Level 10
November 15, 2016

Switching the layout from comma-delimited to an indented list is very simple using a Velocity script.

The question is how these values exist in the first place. Are they already in a consistent comma- or semi-colon delimited string field?

Level 2
November 15, 2016

They come to me like this: emailaddress;firstname;lastname;dog;cat;;;bird;lizard;;; 

The double semi-colons represent a column header for which the lead has no value in

SanfordWhiteman
Level 10
November 15, 2016

Simple stuff: semi-delimited with an offset. This is already in a text/textarea field?

Sara_Greaves
Level 4
November 15, 2016

Hi Duke,

How are you collecting the data? Do you have multiple fields flagged as true/false (i.e. a field for dog, a field for cat), or do you have one field with multiple pets (this is what it sounds like from the way your question is worded)?

Level 2
November 15, 2016

The data comes to me like this in semi-colon deliminated files

emailaddress;firstname;lastname;dog;cat;;;bird;lizard;;;

Where there are 2 consecutive semi-colons its because they dont have a pet that is one of the column headers.

Josh_Hill13
Level 10
November 15, 2016

There is a post on using Velocity scripting if you are interested.

Level 2
November 15, 2016

I am interested.

Grégoire_Miche2
Level 10
November 15, 2016
SanfordWhiteman
Level 10
November 17, 2016

@Duke Janssen​​ it would be good if you could come back to this thread and mark my answer as ​Correct.