Scripted token issue - not resolving to correct URL | Community
Skip to main content
Kevin_Stinson
New Participant
March 24, 2022
Solved

Scripted token issue - not resolving to correct URL

  • March 24, 2022
  • 2 replies
  • 3085 views

We are having an issue with a token.

 

We are dynamically creating a URL for a link to a PDF. When we have the full URL set in a variable $murl the link points to the correct PDF. It all works fine but there is no tracking link.

#set($murl = "https://www.franklintempleton.com/investments/options/mutual-funds/products/$fund.fundOneTISNumber/$fund.shareClassCode/")

<a target="_blank" href="${murl}" style="font-family: arial; text-decoration: underline; font-weight: bold;">

 

But if we remove the https:// from the variable and add it in the in the link portion of the script so we can get tracking the link, the link generated with tracking does not go to the correct URL. They all seem to point to the same PDF.

#set($murlPartial = "www.franklintempleton.com/investments/options/mutual-funds/products/$fund.fundOneTISNumber/$fund.shareClassCode/")

<a target="_blank" href="https://${murlPartial}" style="font-family: arial; text-decoration: underline; font-weight: bold;">

I have created a test where I render both versions on the email, and it looks like the variables are created fine when output on their own.

The main reason we are trying to separate the URL is to allow us to track the link.

Let me know if there is a better approach to take.

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

This is a known limitation when you attempt to reuse the same Velocity $variable to output links. I wrote about the workaround here: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
March 24, 2022

This is a known limitation when you attempt to reuse the same Velocity $variable to output links. I wrote about the workaround here: https://blog.teknkl.com/multiple-marketo-tracked-links-in-velocity/

Kevin_Stinson
New Participant
March 25, 2022

@sanfordwhiteman yes, we are looping through with the script. I will take a look at your work-around. Thanks!

Kevin_Stinson
New Participant
March 28, 2022

Sorry for the delay, other priorities came up.

But relooked at the existing token and I may need one of our developers to look at implementing your code. There is a lot going on in the token now.

#foreach($fund in $sorter.sort($monthlyFundUpdates_cList,["rankIndex:asc","fundNameMarketing:asc","fund_Nasdaq_Symbol:asc"]) ) #if($velocityCount<=10) <table border="0" bgcolor="#ffffff" width="100%" cellpadding="0" cellspacing="0" style="border-bottom: 1px solid #eeeeee;"> <tbody> <tr> #set($mFundNum = $fund.fundInvestarNumber) #set ($index = $mFundNum.indexOf('00')) #set ($index = $index + 2) #set ($mFundID = $mFundNum.substring($index)) #set($murlPartial = "www.xyz.com/$fund.fundOneTISNumber/$fund.shareClassCode/") <td width="20%" style="font-family: Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px;" align="left"><span style="font-family: Arial, sans-serif; font-size: 13px; color: #000000;"><a target="_blank" href="https://${murlPartial}" style="font-family: arial; text-decoration: underline; font-weight: bold;"> #if($fund.fund_Nasdaq_Symbol) $fund.fundNameMarketing - ($fund.fund_Nasdaq_Symbol) #else $fund.fundNameMarketing #end </a> </span></td> <td width="8%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center"> #if($fund.shareClass) $fund.shareClass #else - #end </td> <td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center"> ##if(parse.float($fund.distributionRate)>0.00) #if($fund.distributionRate) #if(($mFundID == '00150' || $mFundID == '00250' || $mFundID == '00353' || $mFundID == '00650' || $mFundID == '00850'|| $mFundID == '00192'|| $mFundID == '00292'|| $mFundID == '00372' || $mFundID == '00192' || $mFundID == '00292' || $mFundID == '00372' || $mFundID == '00384' || $mFundID == '00385' || $mFundID == '00386' || $mFundID == '00484' || $mFundID == '00485' || $mFundID == '00486' || $mFundID == '00584' || $mFundID == '00585' || $mFundID == '00586' || $mFundID == '00641' || $mFundID == '00642' || $mFundID == '00643' || $mFundID == '00692' || $mFundID == '00884' || $mFundID == '00885' || $mFundID == '00886') && $fund.isLeggMasonProduct == 'N') - #else #set($value_rate = $fund.distributionRate) #set($ScoreCount = $convert.toNumber($value_rate) ) #if( $ScoreCount != 0 ) $number.format('#0.00', $fund.distributionRate)% #else - #end #end #else - #end </td> <td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center"> #if($fund.standardized_Yield) #if(($mFundID == '00150' || $mFundID == '00250' || $mFundID == '00353' || $mFundID == '00650' || $mFundID == '00850'|| $mFundID == '00192'|| $mFundID == '00292'|| $mFundID == '00372' || $mFundID == '00192' || $mFundID == '00292' || $mFundID == '00372' || $mFundID == '00384' || $mFundID == '00385' || $mFundID == '00386' || $mFundID == '00484' || $mFundID == '00485' || $mFundID == '00486' || $mFundID == '00584' || $mFundID == '00585' || $mFundID == '00586' || $mFundID == '00641' || $mFundID == '00642' || $mFundID == '00643' || $mFundID == '00692' || $mFundID == '00884' || $mFundID == '00885' || $mFundID == '00886') && $fund.isLeggMasonProduct == 'N') - #else #set($value_rate1 = $fund.standardized_Yield) #set($ScoreCount1 = $convert.toNumber($value_rate1) ) #if( $ScoreCount1 != 0 ) $number.format('#0.00', $fund.standardized_Yield)% #else - #end #end #else - #end </td> <td width="11%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold; padding: 10px 0px 10px 0px; border-left: 1px solid #eeeeee;" class="nav6" align="center"> #if($fund.yTDTotalReturn) $number.format('#0.00', $fund.yTDTotalReturn)% #else N/A #end </td> <td width="39%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 11px; font-weight: bold; border-left: 1px solid #eeeeee; padding: 0px 0px 0px 0px;" align="center"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody> <tr> <td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center"> #if($fund.av_An_Tot_Ret_1) $number.format('#0.00', $fund.av_An_Tot_Ret_1)% #else N/A #end </td> <td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center"> #if($fund.av_An_Tot_Ret_3) $number.format('#0.00', $fund.av_An_Tot_Ret_3)% #else N/A #end </td> <td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center"> #if($fund.av_An_Tot_Ret_5) $number.format('#0.00', $fund.av_An_Tot_Ret_5)% #else N/A #end </td> <td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" align="center"> #if($fund.av_An_Tot_Ret_10) $number.format('#0.00', $fund.av_An_Tot_Ret_10)% #else N/A #end </td> <td width="20%" style="font-family: Arial, Helvetica, sans-serif; color: #333333; font-size: 13px; font-weight: bold;" class="nav6" align="center"> #if($fund.av_An_Tot_Ret_Life) $number.format('#0.00', $fund.av_An_Tot_Ret_Life)% #else N/A #end <br /><span style="font-size: 9px; font-weight: bold; color: #777;"> #if($fund.pER_Fund_Inception_Date) $date.format("MM/dd/yyyy", $convert.parseDate($fund.fundPerformanceInceptionDate, "yyyy-MM-dd")) #else N/A #end </span></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> #end #end
Jo_Pitts1
Community Manager
March 24, 2022

@kevin_stinson ,

are you looping within Velocity and creating multiple URLs within a single email?


Can you show us the code?

 

Cheers

Jo