1

I've created a REST web service on Salesforce and exposed it as a public service (Using Sites). Now I am consuming this service from an external web site. I need to get the Salesforce base URL inside this web service code to populate a URL. I used,

String baseUrl = System.URL.getSalesforceBaseUrl().toExternalForm();

When I call the web service from the external site, this returns always the custom URL I added for the site (Web Service), but not the real base URL which I see when I logged in to the Org.

I need to get the actual base URL which I see when I logged in to my Org. Appreciate your support.

1
  • I think it's better for you to hold the URL for specific org in a custom setting and change it according base of the ORG. If it work, please mark as right Answer! Sep 13, 2017 at 5:56

1 Answer 1

-1

I think it's better for you to hold the URL for specific org in a custom setting and change it according base of the ORG.

If it works, please mark as right Answer!

1
  • Yes this approach works, But my client wants to use a dynamic way. He does not want to update the custom settings once deployed to Production. Sep 20, 2017 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .