Re: Content based on field value

Kathi_Gosche
Level 4

I have a series of related events where I am using one form to register for the events. When filling out the form, the user is presented with a selection list containing all the events. Multiple selections are being allowed.

I don't want to create & manage multiple unique confirmation emails, nor do I want to send multiple emails to my user. Is there a way to pull in content based on field value?

For instance:

Field value = 2/7, 2/10, 2/20

Available for selection in the form = 2/7, 2/8, 2/10, 2/9, 2/20, 2/21, 2/22

Create one email where a smart list is used to look at the field value. If field contains X, then pull this token into the body of the email.

You registered to attend the below lectures:

  • Science for Elementary Students
    February 7, 2017 at 2:00 pm, McGill Auditorium
    Add to calendar

  • English for Elementary Students
    February 10, 2017 at 3:00 pm, Jhonson Auditorium
    Add to calendar

  • French for Elementary Students
    February 20, 2017 at 2:00 pm, McGill Auditorium
    Add to calendar
Tags (1)
16 REPLIES 16
Dory_Viscoglio
Level 10

Yes, the reason I suggested velocity scripting and not segmentations with dynamic content is because there are many combinations of dates that a person might select, and you'd have to set something up for every single combination.

Otherwise, there really isn't anything native to Marketo that will help out here.

Michael_White
Level 5

Hi Kathi,

You can also accomplish this using segmentations and dynamic content -- you could create a new segmentation for "Event Date" and create segments which look for the field value you passed through in the form.

Then in the email you'd be able to make the section you want to change Dynamic, and update the content for each segment in there.

Here's Marketo's docs on using Dynamic Content:

Understanding Dynamic Content - Marketo Docs - Product Docs

Using Dynamic Content in a Email - Marketo Docs - Product Docs

Kathi_Gosche
Level 4

Thanks Michael. I see the same limitation that Dan mentions with segments. If leads could belong to multiple segments, that would work though. Is there a way to use smart lists in place of segments?

Michael_White
Level 5

Ah, yep, I missed the requirement on allowing for multiple selections, so you are going to want to go down the path recommended by Dory/Sanford, since segments unfortunately won't be able to work around that.

SanfordWhiteman
Level 10 - Community Moderator

I thank you for bringing it up because it helps demonstrate, like we were talking about in our local MUG the other week, how Velocity can pick up where segments leave off.

SanfordWhiteman
Level 10 - Community Moderator

Also: you say the field has comma-delimited values (2/7, 2/10, 2/20). Are you sure they aren't semicolon-delimited, since that's the way they're saved on form submit?

Kathi_Gosche
Level 4

You're right, it is a semicolon rather than a comma. My mistake.

SanfordWhiteman
Level 10 - Community Moderator

No, Smart Lists on their own can't be consulted at send time. Membership in segments can be decided by Smart Lists, but doesn't work around the problem.  You also have to consider that you have a limited # of segmentations in your instance... in the end, segments are a dead end here.

The Velocity to do this is quite easy.  If you give me a couple hours (I'm sick, otherwise I'd say a couple minutes!) I'll give you the framework that'll get you 95% of the way there.

SanfordWhiteman
Level 10 - Community Moderator

OK, here's VTL to get it done.

When adding the Email Script Token, remember to check off, the in the right-hand tree, the Lead field that is holding your semicolon-delimited list all events they've signed up for.  In the code below, I called that field "bookings" but that's just a placeholder that you should replace with the real field in your instance.

##----POINT TO THE LEAD FIELD WITH ALL EVENTS----

#set( $allBookingsFlat = $lead.bookings )

##----SET UP EVENT METADATA----

#set( $events = {

  "2/7" : {

  "name" : "Science for Elementary Students",

  "longDesc" : "February 7, 2017 at 2:00 pm, McGill Auditorium",

  "calLink" : "calendar.com/1223"

  },

  "2/10" : {

    "name" : "English for Elementary Students",

    "longDesc" : "Februry 10, 2017 at 3:00 pm, Jhonson McGill Auditorium",

    "calLink" : "calendar.com/4334"

  },

  "2/20" : {

    "name" : "French for Elementary Students",

    "longDesc" : "February 20, 2017 at 2:00 pm, McGill Auditorium",

    "calLink" : "calendar.com/6556"

  }

} )

##----SET UP YOUR OUTPUT FORMAT----

#define( $output )

${event.name}<br />

${event.longDesc}<br />

<a href="http:​//${event.calLink}">Add to calendar</a><br/>

<br/>

#end

##----NO NEED TO EDIT BELOW THIS LINE!----

#set( $bookings = $allBookingsFlat.split(";") )

#foreach( $booking in $bookings )

#set( $event = $events[$booking] )

#if( $event )

${output}

#end

#end

Kathi_Gosche
Level 4

It seems the email script token isn't available in my program. Are they not available in Spark?

Screen Shot 2017-02-03 at 8.30.38 AM.png

SanfordWhiteman
Level 10 - Community Moderator

#cathyackdotgif!

Oops, won't work in Spark.  So I guess you'll have to do something more circuitous.

Kathi_Gosche
Level 4

Thanks for trying Sanford.

Kathi_Gosche
Level 4

Thanks Sanford!!!! I really appreciate this. I'll give it a try and see how it works.

Dan_Stevens_
Level 10 - Champion Alumni

The only problem with this approach is a lead can only be part of one segment within a segmentation.  A lead qualifies for the first matching segment within the list.  Also, leads don't enter segments immediately after potentially qualifying (e.g., registering for an event).  So there would need to be a delay in terms of any future activity (confirmation emails, etc.)

Dory_Viscoglio
Level 10

Hey Kathi, this is a bit more work, but velocity scripting could work here. I would take a look into the threads that have been created in the past with information about this -- there are plenty.

Kathi_Gosche
Level 4

Thanks for the suggestion Dory. Looks like velocity scripting is a programming language and unfortunately, I am not a developer which is why I like using Marketo so much. I was hoping to be able to do this using the tools Marketo offers in its interface. Any ideas?