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
Rajat MajumderRajat Majumder 

How to prevent the symbol "&" from being replaced by "&" ?

string hybrisURL=URL+'OppId='+oppId+'&Country='+country+'&Lang='+lanag+'&Status=Approved&QuoteId='+quoteId;

As mentioned above is URL is used for a certain function. But when the URL is redirected the character '&' changes to '&'.

And this is creating a problem for me. It is showing the error code 404 page can't be found. With '&' character the page is working fine.

How to resolve the issue? How to restrict the characters from changing?

 

SwethaSwetha (Salesforce Developers) 
HI Rajat,
Please share more details on where this URL is being used?

Related: https://developer.salesforce.com/forums/?id=906F000000098SKIAY
https://developer.salesforce.com/forums/?id=906F00000009AGKIA2

Thanks 
Rajat MajumderRajat Majumder

Hi Swetha, 

Thanks for your reply.

I tried encoding the values, but I am not getting the desired result.

After encoding what I got:

https%3A%2F%2Fservices-q2.abc.com%2FserviceABC%2FABCServiceQuote%2Fedit%2Fquote%2F%3FOppId%3DOPE-00096589212%26Country%3DAU%26Lang%3Den%26RplStatus%3DApproved%26QuoteId%3D0000087752

URL what I am expecting:

https://services-q2.abc.com/servicesABC/ABCServiceQuote/edit/quote/?OppId=OPE 00096589212&Country=AU&Lang=en&RplStatus=Approved&QuoteId=0000087752

I am not sure how to achieve this.