Home SALESFORCEAPEX How to get the Salesforce Instance Server URL from APEX Class

How to get the Salesforce Instance Server URL from APEX Class?

This can be used to get the ID of current record.

[java]

ApexPages.CurrentPage().getParameters().get(‘id’);

[/java]

This can be used to get the current host in the url for e.g: “cs8.salesforce.com”.

[java]

ApexPages.CurrentPage().getHeaders().get(‘host’);

[/java]

You may also like

Leave a Comment