Content based on field value

Kathi_Gosche
Level 4

Content based on field value

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

Re: Content based on field value

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

Re: Content based on field value

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?

Michael_White
Level 5

Re: Content based on field value

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

Dan_Stevens_
Level 10 - Champion Alumni

Re: Content based on field value

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.)

Kathi_Gosche
Level 4

Re: Content based on field value

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?

SanfordWhiteman
Level 10 - Community Moderator

Re: Content based on field value

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

Re: Content based on field value

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

Re: Content based on field value

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

Kathi_Gosche
Level 4

Re: Content based on field value

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