function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pathworkspathworks 

How to URL encode parameters in a formula field?

I need to generate a hyperlink that passes some short text data on the query string - formula would be something like this: HYPERLINK("http://www.aaaaa.com/somewhere?name= & {!Lead_Name}", "My Link").
 
How do I URL encode the {!Lead_Name}?  I did a quick test, and if the lead is named "A&B", the result is /somewhere?name=A&B.  This is clearly wrong - should be ...?name=A%26B.  The value of parameter "name" has been corrupted to "A", and a second parameter B has been added, effectively.  How should I get around this so parameters are encoded properly and not corrupted?
 
Thanks in advance,
Dan
 
Doug ChasmanDoug Chasman
Dan,

This is indeed a bug in the hyperlink() function. I have opened a bug report to track this issue, identified the root cause, and am working to determine when we can get a fix for this deployed.

Doug Chasman

Message Edited by Doug Chasman on 08-02-2006 02:47 AM

pathworkspathworks
 
Great, thanks.
 
In my opinion, the fix will probably require a new function, URLENCODE().  The reason I say so is that following must still work:
 
HYPERLINK("http://www.somesite.com/somepage?a=1&b=2&c=" & URLENCODE({!Lead_Name}))
 
Note that the & after a=1 must not be encoded, but any ampersand or other special characters (?=, etc.) inside the lead name must be encoded, thus the new function.
 
Of course, if it can be fixed without that somehow...then never mind my opinion!
 
Dan
 
falksonfalkson

Was this issue ever solved?  I have a similar problem passing an account to a URL with an "&".

 

MF