Custom content depending on which field was recently updated | Community
Skip to main content
Liz_Davalos
New Participant
January 16, 2018
Solved

Custom content depending on which field was recently updated

  • January 16, 2018
  • 1 reply
  • 1438 views

I'm new to Velocity Scripting, but I want to make a script that generates the name of the newsletter someone has just subscribed to.

Basically whichever trigger fired off the email (a new subscriber was submitted) I want to use the updated subscription field to insert the newsletter's name. I've no clue if this is even possible with velocity script, but barring making separate emails for each I'm not sure of another way to do this in Marketo.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Basically whichever trigger fired off the email (a new subscriber was submitted) I want to use the updated subscription field to insert the newsletter's name. I've no clue if this is even possible with velocity script, but barring making separate emails for each I'm not sure of another way to do this in Marketo.

OK, this is not directly possible in Velocity.

You seem to want the {{trigger.name}} -- that would be the name of the form if you're using a Filled Out Form trigger -- to be accessible in Velocity. This would be convenient, but it's not possible. (Of course, if your form name doesn't contain the newsletter's name, it wouldn't be useful anyway.)

So you would instead need a lead field for LastSubscribedNewsletter. How you manage this field is up to you. You could have it be a hidden field on every form; if it always held an email-ready (friendly) value, you wouldn't even need to pass it through Velocity, you could output the {{lead.token}} as-is. Or if your forms allow more than one subscription to be updated, better that it be called LastSubscribedNewsletters and (using JavaScript) concatenate all the opted-in newsletter names into a single string and then set the hidden field.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 17, 2018

Basically whichever trigger fired off the email (a new subscriber was submitted) I want to use the updated subscription field to insert the newsletter's name. I've no clue if this is even possible with velocity script, but barring making separate emails for each I'm not sure of another way to do this in Marketo.

OK, this is not directly possible in Velocity.

You seem to want the {{trigger.name}} -- that would be the name of the form if you're using a Filled Out Form trigger -- to be accessible in Velocity. This would be convenient, but it's not possible. (Of course, if your form name doesn't contain the newsletter's name, it wouldn't be useful anyway.)

So you would instead need a lead field for LastSubscribedNewsletter. How you manage this field is up to you. You could have it be a hidden field on every form; if it always held an email-ready (friendly) value, you wouldn't even need to pass it through Velocity, you could output the {{lead.token}} as-is. Or if your forms allow more than one subscription to be updated, better that it be called LastSubscribedNewsletters and (using JavaScript) concatenate all the opted-in newsletter names into a single string and then set the hidden field.