Find your content:

Search form

You are here

Company Information in apex

 
Share

I want company's locale info in apex code. How can I get that? Basically, I want company's default timezone and default language.


Attribution to: doga

Possible Suggestion/Solution #1

For anyone still searching for this, here is an updated answer. Building on Daniel Blackhall's answer, you can use the following query to get the Default Time Zone and default Language:

Organization orgDetails = [Select Id, TimeZoneSidKey, LanguageLocaleKey from Organization];

Attribution to: ToskaMan

Possible Suggestion/Solution #2

You can query the Organization object to get the information you are looking for.

Organization orgDetails = [SELECT Id, LanguageLocaleKey FROM Organization WHERE Id = :UserInfo.getOrganizationId()];

There are a whole bunch more fields that are available, that I have left out of the answer.

I have included a clause to only return the organization returned by the UserInfo getOrganizationId static method. I don't know if this is required because I assume there will only ever be one organisation record. I can't confirm this, so have added the clause for safety


Attribution to: Daniel Blackhall

Possible Suggestion/Solution #3

Unfortunately Default Time Zone (and Currency Locale) is not available in Apex. There is an idea for this posted on the idea exchange (http://success.salesforce.com/ideaView?id=08730000000bEGWAA2).

You can get the Language Locale using the method Daniel Blackhall suggested in the other answer.


Attribution to: Ryan Guest
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/3833

My Block Status

My Block Content