SOLVED

Re: Custom content depending on which field was recently updated

Go to solution
Liz_Davalos
Level 3

Custom content depending on which field was recently updated

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom content depending on which field was recently updated

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.

View solution in original post

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Custom content depending on which field was recently updated

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.