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

Getting complete URL of logged in SF instance

Hi All,


I need to get complete URL of the salesforce into which user logged in. Currently when I tried to get URL using ApexPage.getCurrentPage().getUrl(). It only giving me path to the page not give complete URL like


Could any one of you let me know how can I address my problem.





You can use the  getCurrentRequestUrl method of the System.URL class for this.




String url=System.URL.getCurrentRequestURL().toExternalForm();
System.debug('Url = ' + url);