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
sfdcdev.ax551sfdcdev.ax551 

UserInfo.getOrganizationId() does not return SFDC Organization ID

How can I get the Salesforce.com Organization ID that is populated in the Company Profile page from Apex?

 

I tried UserInfo.getOrganizationId(), but that return the ID of the company profile page which is different from the Salesforce.com Organization ID  "field" that we see on the COmpany Profile page.

 

Any help is greatly appreciated.

 

Thanks

 

NasipuriNasipuri

Hi ,

 

I am using the below code and getting expected result

 

ID orgID = UserInfo.getOrganizationId() ;

System.debug('DINESH:: THE ORG ID IS' + orgID) ;

 

18.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
Execute Anonymous: ID orgID = UserInfo.getOrganizationId() ;
Execute Anonymous: 
Execute Anonymous: System.debug('DINESH:: THE ORG ID IS' + orgID) ;
5:19:43.690|EXECUTION_STARTED
5:19:43.690|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
5:19:43.694|METHOD_ENTRY|[1,12]|UserInfo.getOrganizationId()
5:19:43.694|METHOD_EXIT|[1,12]|UserInfo.getOrganizationId()
5:19:43.694|METHOD_ENTRY|[3,1]|System.debug(String)
5:19:43.694|USER_DEBUG|[3,1]|DEBUG|DINESH:: THE ORG ID IS00D500000007p39EAA

 Please make sure you have proper version of the API in the controller.

 

Thanks,

Dinesh Nasipuri

Dinesh.Nasipuri@gmail.com