Activity Forums Salesforce® Discussions How to pass special characters in URL?

  • Gourav

    Member
    April 26, 2016 at 7:42 am

    How to pass special characters in URL e.g I have an JavaScript button in which I am passing a field value in URL that field contains ' in it. When I clicked on button it gives unexpected token error. How to solve that?

  • Prakhar

    Member
    April 26, 2016 at 7:58 am

    Hey,

    You can use formula {!URLENCODE(text)} in your script and replace the text value with the merge field or text string that you want to encode.

    Hope that it solves the issue.

    Thanks.

  • Parul

    Member
    September 20, 2018 at 1:10 am

    Hi,

    String url="http://localhost:8080/safp/contacts/FirmAddress.do?btnAction=FirmAddress&firmId="+URLEncoder.encode("122379069","UTF-8")+"&strLocation="+URLEncoder.encode("[email protected]#$%^&*()_+","UTF-8")+"&async=true&newAccID=112";

    Use URLEncoder.encode()

  • shariq

    Member
    September 20, 2018 at 7:24 pm

    Hi,

    Just Encode using standard EncodingUtil class of salesforce to do it.

    Hope this helps.

Viewing 1 - 4 of 4 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos