SOLVED

Marketo token help

Go to solution
Anonymous
Not applicable

Marketo token help

We are setting up a smart campaign to send an email to an email address that lives on an opportunity field in Salesforce. In order to do this, I set up a velocity script token to pull the email address from SF and will use a "send alert" flow step to send the actual email.

Token1.PNG

Does anyone have any ideas if this velocity script token looks correct? We have used velocity script tokens in the past but somehow it did not trigger the email. We are using a trigger campaign when a field on the opportunity is updated in SF. Not sure if the issue is with the token itself or with using a token in this "send alert" flow step.

#if ( (! ${TriggerObject.Referral_email__c} ) || ( ${TriggerObject.Referral_email__c == '') )

#set($referralemail = "")

#else

         #set($referralemail = ${TriggerObject.Referral_email__c})

    

#end

${referralemail}

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Velocity script token help

Hi Carly,

Provided that you have the 'lead' level field 'referral email' correctly populated, you can use the flow step like,

pastedImage_0.png

to send email to that email address.

Hope this helps. Please feel free to reach out at Rajesh@BrightHooks.com if you have any more questions.

Rajesh

By the way, did you do the population of the data in this field using logic in SFDC?

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: Velocity script token help

You can't use Velocity tokens in a flow step.  They are simply email scripting tools as the name implies. In other contexts, they are just a block of VTL code, with nothing to execute them.

Short of redoing the computation in SFDC (which admittedly doesn't solve every problem) the only way to get the results of a VTL script into a standard {{my.token}} is to use a very convoluted method I've been working on in my "spare" time... even if I get it working it'll probably be too ugly to tell anyone about.  So consider it not doable, AFAIK.

Anonymous
Not applicable

Re: Velocity script token help

Thanks Sanford that's good to know.

Anonymous
Not applicable

Re: Velocity script token help

Hi Carly,

As Sanford mentioned here. Velocity Scripting in Marketo is only for 'rendering' in email. It is not (as least directly) possible to 'assign' the value you calculate in a velocity script to a program token or even a lead field. It is only to manipulate the contents of the email message.

But I am not sure if that is what you are explaining here as the problem. Are you trying to 'find the email address from the Opportunity field' and then send email alert to 'that email address'? Even if it was the case, why would you use 'program level' 'my' tokens then? Program level token value will be common to all the leads going through this flow step. In that case, you should be using a lead level field to store that email address for each lead as that email address would be different for each lead.

If my.TestReferral value is indeed a valid email address common to all the leads, and instead of hard coding you chose to use program level token, you can try the following to see why the email did not go through.

1> From the email, remove the velocity script all together.

Try to test it with 'actually' triggering the flow. ('Send email as test' does not work for email scripting.)

Do you get the email in this case?

2> Now try adding the velocity script again, approve the document.

And test again.

Do you get the email?

See if these steps help you find out if the error is in velocity script. 

Hope this helps

Rajseh Talele

Anonymous
Not applicable

Re: Velocity script token help

Hi Rajseh,

Yes that makes sense about the velocity script and rendering in an email, thanks for explaining.

So yes exactly, in this case we are trying to 'find the email address from the Opportunity field' and then send an email to 'that email address'. I’ll see if we can get this to work by making this a lead level field that will be a unique value for each lead.

Thanks for the help!

Anonymous
Not applicable

Re: Velocity script token help

Hi Rajseh,

I'm looking back into this today and have a few more questions. So, we now have the field available for all records in marketo and each lead has a unique "referral email". I'm still not sure how to actually send an email to this address. Do i need to create a token in order to send an email to this email address?

Thanks!

Carly

Anonymous
Not applicable

Re: Velocity script token help

Hi Carly,

Provided that you have the 'lead' level field 'referral email' correctly populated, you can use the flow step like,

pastedImage_0.png

to send email to that email address.

Hope this helps. Please feel free to reach out at Rajesh@BrightHooks.com if you have any more questions.

Rajesh

By the way, did you do the population of the data in this field using logic in SFDC?

Anonymous
Not applicable

Re: Marketo token help

Hi Rajesh, hmm so the field came up like this: {{company.Referral email (A)}} and is located under "SFDC custom fields" on the lead. And yes, this field is populated using logic in SFDC. Could this be the problem here?