Best way to display a URL field from an Opportunity in an email? | Community
Skip to main content
EllenSchwier
New Participant
July 16, 2021
Solved

Best way to display a URL field from an Opportunity in an email?

  • July 16, 2021
  • 1 reply
  • 3814 views

I have an email where I need to display a URL that is stored in a field on the Opportunity. I successfully wrote a Velocity script that populates a token with this field from the most recent active opportunity. However, I am running into the same problem that this post discusses. Because the field is a URL, the email script is not always compiling. I was seeing the issue in about 50% of clicks, that the link actually shows as the script itself. At first I wanted to solve it by transferring the field from the opportunity to the person whenever the field was updated. But that did not work

 

Summary:  I am pulling a URL from an opportunity using a script token. I use it in an email link like this: {{my.scripttoken}}. Tracking the link breaks how this URL is shown in the actual email. Any suggestions?

Best answer by SanfordWhiteman

That article is almost completely incorrect and should be removed. I’ll work on that.

 

The actual (and only) problem with links in Velocity is when you reference the same Velocity variable in multiple URLs, expecting it to have different values. That doesn’t work, I have a whole blog post about the crazy thing you need to do to solve it.

 

But if you’re only outputting a single URL, then simply ensure you output the entire <a> tag from Velocity. That means the opening <a> through closing </a> and everything in-between.

 

Then insert the {{my.token}} in the appropriate location in the email. Don’t do https://{{my.token}}  when the {{my.token}} is a Velocity token.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
July 16, 2021

That article is almost completely incorrect and should be removed. I’ll work on that.

 

The actual (and only) problem with links in Velocity is when you reference the same Velocity variable in multiple URLs, expecting it to have different values. That doesn’t work, I have a whole blog post about the crazy thing you need to do to solve it.

 

But if you’re only outputting a single URL, then simply ensure you output the entire <a> tag from Velocity. That means the opening <a> through closing </a> and everything in-between.

 

Then insert the {{my.token}} in the appropriate location in the email. Don’t do https://{{my.token}}  when the {{my.token}} is a Velocity token.

EllenSchwier
New Participant
July 19, 2021

Thank you for this! I was able to use this to update my script and it now appears to work.