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:
Solved! Go to Solution.
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.
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.
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.
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.
Hi Sanford,
After changing the variables in your script to match mine, do I just add this to an email script token in Marketo?
Right. And make sure to check off all the fields you're using in the tree on the right-hand-side of Script Editor.
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?
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.
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
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.)