SOLVED

Need to include form selections in confirmation email and change the name of the fields

Go to solution
Ben_Cooper
Level 2

Need to include form selections in confirmation email and change the name of the fields

We've created a form to use as an RSVP for a Conference inside Marketo. We have built boolean fields that users will check on the landing page depending on which events they want to attend at the conference. The actual field names are shorter than what the user will see and select on the landing page where the form is embedded. The user can choose more than one selection. We would like to send a follow up email after the user has submitted the form with his/her selections. I am trying to figure out how to do the following:

  1. In the body of the follow up email, how to show only the selections that the user chose in the form. E.g. You have been confirmed for selections 1, 3, & 7. Would this be a token maybe?
  2. If this is a token of some type, not to use the field name, but somehow be able to translate the field name into something that is readable to the user. e.g. field name is cool event, the user will see it as Cool Event at 10am, Booth #123, in the body of the email.
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Need to include form selections in confirmation email and change the name of the fields

Yep, as predicted by JD, I would do this in Velocity.

## Database field names go on the left, user-friendly names on the right

#set( $booleanFriendlies = {

  "Whitebean__c" : "White Bean Hummus",

  "Cashew_sicle_1" : "Cashew Creamsicle",

  "Pobofu" : "Tofu Po'boy"

})

Your favorite foods are:

#foreach( $fieldin $booleanFriendlies.keySet() )

#if( $lead[$field] == "1" )

$booleanFriendlies[$field]##

#end

#end

This outputs the friendly name for any field that's true.

View solution in original post

18 REPLIES 18
JD_Nelson
Level 10 - Community Advisor

Re: Need to include form selections in confirmation email and change the name of the fields

I did something similar, although not with events, using segmentation. If you're looking to combine topics into one sentence, then I'm sure Sanford will have some velocity scripting for you to do. However, all I did was have a trigger watch for the form, then add each user to a segmentation. Then in my email I had as many segmentation fields as I did topics, and the email would only show those that were applicable to that person.

If you can group them that way, it's a pretty easy way to set it up. If this needs to be scalable, then this isn't the answer (you only get a set # of segmentations and you have to set them each up manually).

But -- for those of us not capable of velocity or anything like that, it worked for me.

Note of caution - make sure your email doesn't send immediately and you allow time for your segmentations to update -- test thoroughly.

Keith_Nyberg2
Level 9 - Champion Alumni

Re: Need to include form selections in confirmation email and change the name of the fields

Hey Ben,

For #2, you can name the fields anything you want in the email body, it's only the token needs to reference the system field name. Another solution to problem #1 is to list all the options in the body of the email with the boolean token for the response next to the values. This will show your default value if empty ("not selected" or whatever you define) or a 1 for True responses, just need to tell the users that 1 = True. See screenshot from Josh Hills MRSG Email preference center. Not as sleek, but it works.

confirmation-page-1.png

confirmation-page-2.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Need to include form selections in confirmation email and change the name of the fields

Yep, as predicted by JD, I would do this in Velocity.

## Database field names go on the left, user-friendly names on the right

#set( $booleanFriendlies = {

  "Whitebean__c" : "White Bean Hummus",

  "Cashew_sicle_1" : "Cashew Creamsicle",

  "Pobofu" : "Tofu Po'boy"

})

Your favorite foods are:

#foreach( $fieldin $booleanFriendlies.keySet() )

#if( $lead[$field] == "1" )

$booleanFriendlies[$field]##

#end

#end

This outputs the friendly name for any field that's true.

Ben_Cooper
Level 2

Re: Need to include form selections in confirmation email and change the name of the fields

Hi Sanford,

After changing the variables in your script to match mine, do I just add this to an email script token in Marketo?

SanfordWhiteman
Level 10 - Community Moderator

Re: Need to include form selections in confirmation email and change the name of the fields

Right. And make sure to check off all the fields you're using in the tree on the right-hand-side of Script Editor.

Ben_Cooper
Level 2

Re: Need to include form selections in confirmation email and change the name of the fields

I checked off the fields. I can't get the information to fill in the body of the email after it is sent to my inbox through a smart campaign. Should I be using the REST API Name or SOAP API Name instead when referencing the fields? Or does the friendly name suffice?

SanfordWhiteman
Level 10 - Community Moderator

Re: Need to include form selections in confirmation email and change the name of the fields

The left-hand-side of the $booleanFriendlies uses the SOAP names. If you are uncertain, you can (temporariily) drag a field from the tree onto the Script Editor "canvas".  This will tell you its proper Velocity name.

Ben_Cooper
Level 2

Re: Need to include form selections in confirmation email and change the name of the fields

I still can't get this to show in the body of the email when it is sent to me. I am confident I have the correct token applied in the email. Does anything look wrong with the code?

## Database field names go on the left, user-friendly names on the right 

#set( $booleanFriendlies = { 

  "sessionBooks" : "Books: Thursday, February 1, 11:00 – 11:20am"

 

})  

#foreach( $fieldin $booleanFriendlies.keySet() ) 

#if( $lead[$field] == "1" ) 

$booleanFriendlies[$field]## 

#end 

#end 

SanfordWhiteman
Level 10 - Community Moderator

Re: Need to include form selections in confirmation email and change the name of the fields

What do you see if you add this line to the token:

sessionBooks: ${lead.sessionBooks}

(Also pls highlight code using the Advanced Editor's Syntax Highlighter -- v. hard to read otherwise.)

pastedImage_2.png