+ Start a Discussion
HeenaHeena 

Getting ORG ID in Apex Class

Hi,

 

I wanted to know if it is feasible to access the org id of my salesforce org (without  querying the Organization table) in an Apex Class. Something similar to what we do in VisualForce using the {!$organization.id} global field.

 

Thanks,

Heena

Best Answer chosen by Admin (Salesforce Developers) 
AlsoDougAlsoDoug

You could try

 

UserInfo.getOrganizationId

All Answers

AlsoDougAlsoDoug

You could try

 

UserInfo.getOrganizationId

This was selected as the best answer
HeenaHeena
Thanks AlsoDoug.
AlsoDougAlsoDoug
Good to know it worked :robothappy: