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
AndraskoAndrasko 

Get Organization details

Hy everyone,


I want to set the organization data (for example: name, city, country) to an input field.


First I try it in visualforce page:

 

<apex:page standardController="Organization" >

<apex:inputText value="{!$Organization.Name}" />

</apex:page>

 

But I get the following error message:


Error: Unknown property 'OrganizationStandardController.$Organization'

 

After that I change the controllert to MyController.

 

Anyone knows how can I get the Organization data with apex code.


Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

Organization myOrg = [Select o.WebToCaseDefaultOrigin, o.UsesStartDateAsFiscalYearName, o.UiSkin, o.TrialExpirationDate, o.SystemModstamp, o.Street, o.State, o.ReceivesInfoEmails, o.ReceivesAdminInfoEmails, o.PrimaryContact, o.PreferencesRequireOpportunityProducts, o.PostalCode, o.Phone, o.OrganizationType, o.Name, o.MonthlyPageViewsUsed, o.MonthlyPageViewsEntitlement, o.LastModifiedDate, o.LastModifiedById, o.LanguageLocaleKey, o.Id, o.FiscalYearStartMonth, o.Fax, o.Division, o.DefaultPricebookAccess, o.DefaultOpportunityAccess, o.DefaultLocaleSidKey, o.DefaultLeadAccess, o.DefaultContactAccess, o.DefaultCaseAccess, o.DefaultCampaignAccess, o.DefaultCalendarAccess, o.DefaultAccountAccess, o.CreatedDate, o.CreatedById, o.Country, o.ComplianceBccEmail, o.City From Organization o];

 

That will retrieve you the organization details in Apex Code.

All Answers

Cory CowgillCory Cowgill

Organization myOrg = [Select o.WebToCaseDefaultOrigin, o.UsesStartDateAsFiscalYearName, o.UiSkin, o.TrialExpirationDate, o.SystemModstamp, o.Street, o.State, o.ReceivesInfoEmails, o.ReceivesAdminInfoEmails, o.PrimaryContact, o.PreferencesRequireOpportunityProducts, o.PostalCode, o.Phone, o.OrganizationType, o.Name, o.MonthlyPageViewsUsed, o.MonthlyPageViewsEntitlement, o.LastModifiedDate, o.LastModifiedById, o.LanguageLocaleKey, o.Id, o.FiscalYearStartMonth, o.Fax, o.Division, o.DefaultPricebookAccess, o.DefaultOpportunityAccess, o.DefaultLocaleSidKey, o.DefaultLeadAccess, o.DefaultContactAccess, o.DefaultCaseAccess, o.DefaultCampaignAccess, o.DefaultCalendarAccess, o.DefaultAccountAccess, o.CreatedDate, o.CreatedById, o.Country, o.ComplianceBccEmail, o.City From Organization o];

 

That will retrieve you the organization details in Apex Code.

This was selected as the best answer
AndraskoAndrasko

Thanks for the quick answer. It's works. :smileyhappy: