SOLVED

Dynamically pull in a list of feature(s) into the body of an email.

Go to solution
Mkoran
Level 1

Dynamically pull in a list of feature(s) into the body of an email.

We are collecting features the prospect would like and are pulling them into a text only field as such example listed here:

 

Business Phone Number;Call Forwarding;Ring Groups;Mobile App;Call Blocking;Call Recording;

 

I'd like to dynamically pull in these features into an email but I am not sure the most efficient way to go about it. I was thinking of using a snippet, but if more than one feature is selected the body of the email could get a bit long. Now I am thinking I perhaps need to go the route of building a token within the program or perhaps use velocity scripting. 

 

Has anyone done this before and has a viable solution?

 

Thank you!

 

Monica

1 ACCEPTED SOLUTION

Accepted Solutions
jsiebert
Level 5

Re: Dynamically pull in a list of feature(s) into the body of an email.

⚠️ This post has been edited for accuracy by a moderator.

@Mkoran I did a similar project using an email scripting token pulling boolean fields from my preference center. See below for the velocity script I pieced together (I am not an expert on velocity at ALL!) 

 

#if( $lead.PreferenceField1.equals("1") )
PREFERENCE 1 <br>##

#end

#if( $lead.PreferenceField2.equals("1") )
PREFERENCE 2<br>##

#end

#if( $lead.PreferenceField3.equals("1") )
PREFERENCE 3<br>##

#end

#if( $lead.PreferenceField4.equals("1") )
PREFERENCE 4<br>##

#end

#if( $lead.PreferenceField5.equals("1") )
PREFERENCE 5<br>##

#end

 

 

I think for a string field, you would want to use $lead.token.contains("String")

EDIT: Don’t use contains for a delimited string. Always split on the delimiter (here the semicolon).

 

Dynamic content would be impossible since you would want people to qualify for more than one feature. The segmentation would pull your priority field and they wouldn't be able to qualify for any other segments, even if they chose multiple features. 

 

I think your best bet is using velocity scripting! 

Jack Siebert

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Dynamically pull in a list of feature(s) into the body of an email.


Business Phone Number;Call Forwarding;Ring Groups;Mobile App;Call Blocking;Call Recording;


Not sure what you mean by “long”. That’s just a tiny string?

If you're storing that value in a String or Text type field on each lead, you’d need Velocity to split it on the semicolon and format it more prettily.

 

I think you need to explain your case more thoroughly, there’s not enough to go on here.

Mkoran
Level 1

Re: Dynamically pull in a list of feature(s) into the body of an email.

Thanks Sandford! I knew you could help point me in the right direction!

 

Current Text Field Data Collection is as follows: Business Phone Number;Call Forwarding;Ring Groups;Mobile App;Call Blocking;Call Recording;

 

What I would like Marketo to display it as in an email is:

 

Business Phone Number

Call Forwarding

Ring Groups

Mobile App

Call Blocking

Call Recording

 

I am thinking I need to use some velocity scripting code to pull each feature in individually. Such as:

 

Mkoran_0-1702307783577.png

But I am not sure what the code needs to say here: 

Mkoran_1-1702307852398.png

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Dynamically pull in a list of feature(s) into the body of an email.

#set( $features = $lead.desiredFeatures.split(";") )
${display.list( $features, "<br>" )}

 

You should def'ly do some reading about Velocity if you’re going to put this in production — my blog posts are the best place to go!

Mkoran
Level 1

Re: Dynamically pull in a list of feature(s) into the body of an email.

I was on your blog post this morning. Did you have any recommended articles I can start with?

Thanks again!

 

Monica

SanfordWhiteman
Level 10 - Community Moderator

Re: Dynamically pull in a list of feature(s) into the body of an email.

I don‘t have a particular reading order (though maybe should!). Just everything with the velocity tag.

jsiebert
Level 5

Re: Dynamically pull in a list of feature(s) into the body of an email.

⚠️ This post has been edited for accuracy by a moderator.

@Mkoran I did a similar project using an email scripting token pulling boolean fields from my preference center. See below for the velocity script I pieced together (I am not an expert on velocity at ALL!) 

 

#if( $lead.PreferenceField1.equals("1") )
PREFERENCE 1 <br>##

#end

#if( $lead.PreferenceField2.equals("1") )
PREFERENCE 2<br>##

#end

#if( $lead.PreferenceField3.equals("1") )
PREFERENCE 3<br>##

#end

#if( $lead.PreferenceField4.equals("1") )
PREFERENCE 4<br>##

#end

#if( $lead.PreferenceField5.equals("1") )
PREFERENCE 5<br>##

#end

 

 

I think for a string field, you would want to use $lead.token.contains("String")

EDIT: Don’t use contains for a delimited string. Always split on the delimiter (here the semicolon).

 

Dynamic content would be impossible since you would want people to qualify for more than one feature. The segmentation would pull your priority field and they wouldn't be able to qualify for any other segments, even if they chose multiple features. 

 

I think your best bet is using velocity scripting! 

Jack Siebert