You need to sign in to do that
Don't have an account?
Visual Force controller extension's access through getRecord()
When an extension to a VisualForce controller uses standardcontroller.getRecord(), it seems only to get access to the fields of the sObject that the standard controller retrieved in its SOQL query.
The standard controller only seems to retrieve those fields requested of it on the VisualForce page. In other words, the standard controller seems to make a SOQL query that includes only those fields asked of it, and that does not include those fields requested of the extension.
My question is how is it that the standard controller knows what fields are asked of it on the VisualForce page? How does it know what fields to query for in the SOQL query? The fields that the standard controller will have to make a SOQL query for are not passed in through the Page Reference, are they? Is there another mechanism at work?
ThomasTT
Now you mention it, I have experienced this behavior as well - I could only use the fields in the extension if I included them in a hidden section on the page, as described by by Thomas below...
I do that, too - query it again for myself.
I'm not sure the automatic query works for child objects (e.g. account.RecordType.Name). Especially in triggers, I query the target objects again for my self to use those child objects.
But it is really wasting resource if it is about just a field, and hidden output fields are the official way, so... here we go.
ThomasTT