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
Tejas Wadke 5Tejas Wadke 5 

How to add spaces in url

Hello,

I want to add a space between firstname and lastname.
I tried using %20 in an apex trigger but it does not accept the '%' and gives an error 'no viable character'.

https://appfeedback-developer-edition.na30.force.com/survey/?email='+con.email+'&fullname='+con.firstname+%20+con.lastname
Please help me on this.
Mani RenusMani Renus
Can you try this one
'https://appfeedback-developer-edition.na30.force.com/survey/?email='+con.email+'&fullname='+con.firstname+'  '+con.lastname
Rajiv Penagonda 12Rajiv Penagonda 12
See this (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_encodingUtil.htm#apex_System_EncodingUtil_urlEncode) link. Example below:
String lStrParams = EncodingUtil.urlEncode('FIRST_NAME LAST_NAME', 'UTF-8');
String lStrURL = 'https://www.tester.com?firstname=' + lStrParams;