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
Luis PereraLuis Perera 

How can I find and Org Id associated to a Visualforce page without logging in to the org?

Sandeep WaliaSandeep Walia
Hey Luis,

There are 2 ways to get Org Id in a Visualforce Page.
1. {!$Organization.Id}(link (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_organization.htm)) - You can either directly use this in the VF page or in your VF Page javascript to get the Org Id
2. In case you require it in the VF Page Apex controller you can use UserInfo (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_userinfo.htm) Class and use getOrganizationId() method to get the org Id.

Hope this helps,
Sandeep