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

How can we get the Organization instance ?

Good day, 


I try using following code and i get null at all ? can someone please let me know why do i miss out to get such info ?



System.debug('domain string : ' +Site.getDomain());

System.debug('getCustomWebAddress string : ' +Site.getCustomWebAddress());

System.debug('getCurrentSiteUrl String :' +Site.getCurrentSiteUrl());

System.debug('Sub domain String :' +Site.Subdomain);

System.debug('TopLevelDomain String :' +Site.TopLevelDomain);

System.debug('getOriginalUrl String :' +Site.getOriginalUrl());


between, i would like to get the organization instance name but is there a method to retrieve it ?


ie: ....what i want is to get back the 'mycompany' ? how i can do that ?


Thank you ! 


Message Edited by Nakata on 03-09-2010 05:48 AM



Be aware that you can't access the Organization object with a Standard Platform user.  

We created a setup page invisible to the customer in order to store organization related informations.




Thanks Lauren, 


Our company using enterprise version , is there any setting required to enable it ? appreciated your guidance on this ! 


Nakata, did you ever get a response/solution to this?  We have Enterprise as well and I'm not finding any documentation whatsoever as to why these Site classes are returning null values in Apex code (other than this post).


Really frustrating.  Trying to prepare for the subdomain change in two weeks and Apex classes are the last place we've hardcoded it in.