AnsweredAssumed Answered

URL encoding in Velocity scripts?

Question asked by Bishoy Riad on Nov 29, 2019
Latest reply on Nov 29, 2019 by Sanford Whiteman

Hi Marketo Nation,

 

Curious if there's a standard for URL encoding in Velocity scripts. Below is a {{my.Calendly_Link}} custom token script that outputs a Calendly link. However, the URL printed at the end has non-ASCII characters such as = (equals sign), as well as & (ampersand).

 

Here's the current script (without URL encoding) at line 12:

 

#if(($lead.Owner_Calendly_Link__c.isEmpty() || $lead.Owner_Calendly_Link__c == "-") && $lead.Number_of_Opportunities == "0")
  #set($calendlylink = "calendly.com/fresh-tracks-canada")
#elseif($OpportunityList.get(0).Owner_Calendly_Link__c.isEmpty() || $OpportunityList.get(0).Owner_Calendly_Link__c == "-")
  #set($calendlylink = "calendly.com/fresh-tracks-canada")
#elseif((!$lead.Owner_Calendly_Link__c.isEmpty() && $lead.Owner_Calendly_Link__c != "-") && $lead.Number_of_Opportunities == "0")
  #set($calendlylink = "${lead.Owner_Calendly_Link__c}")
#elseif(!$OpportunityList.get(0).Owner_Calendly_Link__c.isEmpty() && $OpportunityList.get(0).Owner_Calendly_Link__c != "-")
  #set($calendlylink = "${OpportunityList.get(0).Owner_Calendly_Link__c}")
#else
  #set($calendlylink = "calendly.com/fresh-tracks-canada")
#end
https://${calendlylink}/1?text_color=000000&primary_color=e42f3a

 

Based on my front-end testing, it doesn't seem necessary - just practicing some due diligence.

 

Thanks!

Outcomes