3

I'm looking for a way to get the registered Force.com domain from Apex. At the moment I just want to check if there is a domain or not.

This is the domain you register once, when trying to create a public site.

I know you can find the subdomain for a site by querying the field subdomain in the object Site, however, it is possible that a domain is registered but a Site wasn't created. How can I figure out the force.com domain in that scenario?

enter image description here

2 Answers 2

0

This currently isn't exposed in Apex.

0

You might be able to do it by using the getHeaders() method on PageReference class. I've not tested this, but thats where I'd start.

Expose a stupid simple (empty) visualforce page publically, and create a page reference to it. The getURL() method will return the relative url, but hte headers will likely have the full url.

Let me know if it works.

You must log in to answer this question.

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