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
Rahul Sethi 11Rahul Sethi 11 

How can we manage to update the endpoint URL while deploying from sandbox to production environment? Can we do it using change sets? If not, then what are the other ways to accomplish this?

We know that, in production environment, we cannot make changes to a class (which contains the endpoint URL). If we are trying to deploy through CHANGE SETS, the same endpoint URL will be copied to production. Now, I want to understand that, when we use www.abc.com in sandbox but while deploying it to production, the URL should change to www.xyz.com because xyz is the main url for the webservice and we are using abc URL for testing purposes.

Can we do it using custom label?
Best Answer chosen by Rahul Sethi 11
Arpit Jain7Arpit Jain7
Hey Rahul,

I think you can use Names Credential to store your username/password/Endpoints related information rather then hard coding the same in class.

You can find more details on below link

https://help.salesforce.com/articleView?id=named_credentials_about.htm&type=0

Further you can also store the endpoint in custom label also and refer that custom label in your class.

Using these option you can simply updated endpoints in production without any code change.

Thanks
Arpit