You are here:
URLENCODE
Encodes text and merge field values for use in URLs by replacing characters that are illegal in URLs, such as blank spaces, with the code that represent those characters as defined in RFC 3986, Uniform Resource Identifier (URI): Generic Syntax.
For example, blank spaces are replaced with %20, and
exclamation points are replaced with %21.
Use
{!URLENCODE(text)} and replace
text with the merge field or text string that you want to encode.
Tips
- This function is only available in custom buttons and links, and in Visualforce.
- Custom buttons and links with URL content sources have separate encoding settings. If
you use the URLENCODE function to encode a custom button or link that has an encoding
setting specified, Salesforce first encodes the URL according to the custom button or link
setting, then encodes the result. For example, if the URL in a custom link contains a
space and its encoding setting is UTF8, Salesforce first encodes the space to a plus sign
(+), then the URLENCODE function converts the plus sign to its character code,
%2B. - When you include the standard Account field on opportunities
(
Opportunity.Account) in the URLENCODE function, the value of the field is the account ID, not the account name. To encode the account name, create a custom cross-object formula field on opportunities that spans to the account name, and use that field in the URLENCODE function instead ofOpportunity.Account. For example, if the cross-object formula is AccountNameFormula__c, use the following:http://www.google.com/search?q={!URLENCODE (Opportunity.AccountNameFormula__c)}
If the merge field foo__c contains <B>Mark's page<b>, {!URLENCODE(foo_c)} results in: %3CB%3EMark%27s%20page%3C%2Fb%3E

