Get the base URL of Salesforce Org

 How to know base URL of a salesforce org, without using soql Query in apex.

Answer

url baseURL = URL.getSalesforceBaseUrl();
System.debug('Base URL: ' + baseURL ); 

Get the base URL in String. Returns a string representation of the above URL
String baseURL = URL.getSalesforceBaseUrl().toExternalForm();
System.debug('Base URL: ' + baseURL );
Labels:
Join the conversation