I'm trying to use the global variablee '{!$Organization.Id}' and '{!$Profile.Id}' in a visualforce page. When I access the page directly from apex/MyPageName the variables are picked up ok from the Profile my user is assigned to, however when I try to access the page via a Force.com Site the global variables are not picked up correctly. I'm presuming it's because of some settings on the Force.com Site's Guest User profile but I could not find the settings to change on the profile or settings which could affect this.

Does anyone have any tips on where I might be going wrong?


1 Answer 1


Fetch the org id in apex using the below

String orgId = UserInfo.getOrganizationId();
String profileId=userinfo.getprofileid();

and then pass it to the VF Page

  • Hi, Thank you. I should be able to access it in Visualforce though. It seems like a profile issue to me if it works for my own user without going through the Force.com site. Any ideas on what profile setting on the Force.com site must be affecting this?
    – RedQueries
    Apr 26, 2016 at 15:34
  • Hi, I'm not sure what I was doing wrong but {!$Organization.Id} is working now in my VF page.
    – RedQueries
    Jun 9, 2016 at 0:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .