I am trying to pass a parameter to a VF page ie used in force.com site. I pass id of the record in page url. In my extension controller constructor, i use

controller.addFields(new List<String>{'Gue_name__C', 'Checked_c'});
this.Rec = (Analysis__c)controller.getrecord();

When i access this in a Force.com url,it doesnt give me any error but doesnt populate these fields--

It does work when i login to salesforce and if i try to access this page. So i used a SOQL query instead to fetch the data from DB using the id i passed. Why is this so? Am i missing something?

  • 1
    Sounds like a permissions issue. Its very likely that your sites users don't have permission to access the objects/fields without being a logged in user with an appropriate profile assigned to them which gives them access to the records.
    – crmprogdev
    Jul 27, 2013 at 20:17
  • but then in that case how come it works when i fetch the record from datbase ..in that case they can see
    – sfdc99999
    Jul 27, 2013 at 21:53
  • If your controller does it with a SOQL query when not logged in as a user, I'd say it's more likely a situation where it's a related record that's picked up via the query that the record id by itself won't pull up without the added permissions you have via your user profile.
    – crmprogdev
    Jul 27, 2013 at 23:43
  • The particular field could very likely have a look-up to another object would be my best guess as to the cause. That would be the reason to query the database if not logged in as a user since a user would have the needed permissions to directly access the look-up without need of a query.
    – crmprogdev
    Jul 27, 2013 at 23:50
  • The docs suggest it is for pages using dynamic visualforce bindings only - can you post up some more code for us to look at?
    – pbattisson
    Jul 28, 2013 at 16:01

1 Answer 1


Make sure the Site User Profile has read access to the field in question. You will have to goto the site settings and click on "Public Access Settings" to set the permissions for the specific fields you are adding if they do not have read access.

When you perform the SOQL, it uses system permissions and thus gets the field. The addFields()method respects CRUD

You must log in to answer this question.

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