Link is loading an 'Illegal URL'

Hi,

We’re facing the following challenge with a template field that we’re using to display a record name as a hyperlink:

If the name value has a percentage in it, upon clicking on the hyperlink the user is being directed to a blank page with the following message when clicking on the URL:
"Illegal Request

You have sent us an illegal URL or an improperly formatted request."

It seems that the URL is not getting URL encoded. Percentages are not formatting correctly in the URL. How
 do we fix this?

Any help on this would be greatly appreciated.

Thanks!

Can you post the template code that you are using? 

Hi Rob,

I have to be careful as I’m working with Client sensitive information, but I’ll use Contacts and Accounts as an example in the merge fields:

{{Contact__r.Name}}({{Contact__r.Code__c}})

In this case, the field is on a Junction object which is referencing both Account and Contact objects. I hope this helps.

I’m pretty sure that the URL is breaking on the account.name field.  If you URL-encode that field it will probably work.   That looks like this: 

{{#urlEncode}}{{{Account__r.NamecompanyName}}}{{/urlEncode}}

Rob - this worked. Thanks so much for your help!