Be Good & Do Good!

Salesforce – Retrieve server URL in APEX class or trigger

In Visualforce controllers, use ApexPages.currentPage().getHeaders().get(‘Host’) to get the server name (e.g., na1.salesforce.com).

1 Comment

  1. Ruwantha

    try this URL.getSalesforceBaseUrl().toExternalForm()

    Soruce : http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_url.htm

Leave a Reply

Your email address will not be published. Required fields are marked *