RSVP Alert

Jeffrey_Hanraha
Level 3

I have an email alert partial set up to go to our sales team, where I'm have an issue is I'm not sure what token to use that will tell them if the person is attending or not attending when they have filled out the form. We are using the Event RSVP field below is how the checkboxes are set up.

Yes, I'm coming|true

No, I won't be there|false

Thanks!

13 REPLIES 13
Parul_Goyal
Level 1

Hi Jeffrey,

Please try the following Velocity script:

##check if the Event RSVP = 1

#if(${$lead.EventRSVP} == "1")

## set display value is "Yes, I'm coming"

#set($display = "Yes, I'm coming") 

#else 

## set display value is "No, I won't be there" 

#set($display = "No, I won't be there") 

#end

##print the value 

${display}

Please make sure the field must be checked on the right sidebar while writing script. Also, the field name containing response should be the same.

SanfordWhiteman
Level 10 - Community Moderator

There's already working Velocity posted in this thread, Parul, and the same advice!

P.S. Shouldn't use ${formal} notation in conditions as it invites syntax errors.

Anne_Angele1
Level 4

A simpler answer may be to have two alerts - one for attendees, one for declined - so you can simply write in what you want it to say, rather than using a token. Use a choice step to send attendee version if Event RSVP = true; otherwise, send declined.

SanfordWhiteman
Level 10 - Community Moderator

1 token is a lot easier to maintain than 2 emails, I'd say.

Anne_Angele1
Level 4

For you, yes. For someone who is newer to customizing code, maybe not. By simpler, I mean it uses more basic functionality that may be more accessible to someone without coding experience.

Floyd_Alvares2
Level 8

Hi Jeffrey,

Is this Event RSVP field on the lead object in Marketo?

If so you could just leverage the {{lead.Event RSVP}} in the email. That should appear when you click on the tokens section in the email editor.

You could customize your email to look more reader friendly like

I am attending: {{lead.Event RSVP}}

Hope this helps

Floyd

Edit: Sorry just realised that the field is a checkbox. which would only display a 1 or 0 value. 1 = true and "blank" = false. If we need to make this more user friendly you may need to leverage email scripting token to replace the 1 with True and blank with False.

Process would be something like

1. Creating a Email Script "my token": Managing My Tokens - Marketo Docs - Product Documentation

2. Add velocity scripting code (example)

##check if the Event RSVP = 1

#if(${lead.Event RSVP} == "1")

## set display value is "Yes, I am attending"

#set($display = "Yes, I am attending")

#else

## set display value is "No, I am not attending"

#set($display = "No, I am not attending")

#end

##print the value

${display}

3. Add the mytoken value into the email.

SanfordWhiteman
Level 10 - Community Moderator

Booleans are "1" or "" (empty string) in Velocity, not "1" or "0", see https://blog.teknkl.com/velocitip-boolean-string-number-and-message/ and https://blog.teknkl.com/marketo-vtl-strings-all-the-way-down/.

In the first linked post I describe how to use $display.message to choose output based on these Boolean-like strings; another way to do it is like

#set( $mktoBoolean = { "1" : true, "" : false } )

#if( $mktoBoolean[$lead.EventRSVP] )

Yes, I'm attending

#else

No, I'm not attending

#end

Finally, when posting code, use the Advanced Editor's syntax highlighter so it's readable.

https://s3.amazonaws.com/blog-images-teknkl-com/syntax_highlighter.gif

Floyd_Alvares2
Level 8

Thanks for the correction Sanford. Not sure why I wrote 0 when I referred to it as blank in the same line.

Also thanks for the tip - brand new to posting in this forum.

Floyd

Jeffrey_Hanraha
Level 3

Thanks Floyd and Sanford, I tried both scripts and this is what is happening.


If I Select Yes, I'll be attending on the form, the email alert says No, I'm not attending.

Any ideas of to why this my be happening?

Jeff

Floyd_Alvares2
Level 8

Hi Jeffrey

Can you confirm

  • Event RSVP is a boolean field type in Marketo?
  • Also on form submission that the Event RSVP field is checked to true on the record when the option "yes i am attending" is selected?

Thanks

Floyd

Jeffrey_Hanraha
Level 3

Hi Floyd,

I can confirm the following:

  • Event RSVP is a boolean
  • "Yes I am attending" is set to true when selected

Thanks,

Jeff

SanfordWhiteman
Level 10 - Community Moderator

And the Script Editor checkbox, like I said.

SanfordWhiteman
Level 10 - Community Moderator

Remember to check off your field in the tree on the right hand side of Script Editor.

It sounds like your field is not present in the Velocity context.