1 week ago user has asked me to display a custom link on Account that would point to another system we use. Really straightforward stuff, idea being that user is already logged in to both SF and that system.
URL should look like http://internal/unimportant?customer=ABC%20Telecom%20Ltd
.
Custom link, content source "URL", "display in new window", UTF-8 encoding.
Naive attempt:
?customer={!Account.Name}
renders?customer=ABC+Telecom+Ltd
.URLENCODE promises to replace spaces with %20 but
{!URLENCODE(Account.Name)}
rendersABC%2BTelecom%2BLtd.
{!SUBSTITUTE(Account.Name,' ','%20')}
rendersABC%2520Telecom%2520Ltd.
The other system doesn't like plus signs, these really have to be percent-encoded spaces. A percent-encoded plus sign in the #2 is... wow, just wow. 3rd one is even better.
At that point I gave up on the URL and solved it with 1 line of JavaScript. Any idea why it didn't want to work?
EDIT: Got consistent results in Firefox, Chrome and IE although I don't think it's a case of browser trying to fix it for me.
var url = "http://url?customer={!SUBSTITUTE(Account.Name,' ','%20')}"; window.open(url, 'Name of ext. system');
Which makes it kinda inconsistent.