You need to sign in to do that
Don't have an account?
Sudden sites error - seems like a data access issue?
Hi there,
We're running a Sites application at http://citizenschools.force.com/ctapp/ that allows people to sign up to be volunteers with our organization.
On Sunday, 10/11 at 11:30PM EST, we suddenly started to receive Apex Application errors (no changes had been made to the system that day, or in the preceding days).
The error is:
Apex script unhandled exception by user/organization: 00540000000oi8Q/00D400000008qgXVisualforce Page: /ctapp/apex/CT_Application_Page4System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: CT_Application__c.Region__cClass.ctApplicationPage4.<init>: line 17, column 14External entry pointDebug Log:
Any ideas about what could have gone wrong, and where? We're thinking it's a permissions/access issue, but nothing seems to have changed!
Thanks so much,
--Dave
So I think it's an issue with the composition tag..I found the same problem after the new release...
This simple VF page still works - note I am just using a StandardController, no Extensions etc...:
<apex:page standardController="Position__c" title="Job Details" showHeader="false" standardStylesheets="false">
<apex:form >
<!-- The site template provides the site layout and style -->
<!-- Breadcrumb link back to the search page -->
<apex:outputLink value="<- Back to Search" onclick="top.history.go(-1);return false;" />
<br/>
<!-- Job details -->
<apex:pageBlock>
<h3><apex:outputField value="{!Position__c.name}"/></h3><br/><br/>
</apex:pageBlock>
</apex:form>
</apex:page>
But when I add in the apex:composition tag below, it breaks with the following error:
SObject row was retrieved via SOQL without querying the requested field: Position__c.Name
But the tags work fine on every other page when I use a custom controller that has to execute SOQL - just not when I use a standard controller?
<apex:page standardController="Position__c" title="Job Details" showHeader="false" standardStylesheets="false">
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<apex:form >
<!-- The site template provides the site layout and style -->
<!-- Breadcrumb link back to the search page -->
<apex:outputLink value="<- Back to Search" onclick="top.history.go(-1);return false;" />
<br/>
<!-- Job details -->
<apex:pageBlock>
<h3><apex:outputField value="{!Position__c.name}"/></h3><br/><br/>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
All Answers
Note: here's the line in question:
16: this.ct_application = (CT_Application__c)stdController.getRecord();17: setregionId(ct_application.Region__c );
Hey
I don't think it's a permissions issue. It seems that your page is trying to use a field that the SOQL in the controller does not fetch eg.
in my page,
<apex:inputField value="{!MyObject.field1__c}"/>
<apex:inputField value="{!MyObject.field2__c}"/>
and in my controller
public MyObject__c myObject{get;set;}
// some logic
myObject = [SELECT field1__c FROM myObject__c];
ie. field2__c has not been selected and your type of error would be thrown.
As you've said, you haven't made any changes, so I'm not sure how this could happen, however, this is the type of problem that causes this error.
Wes
Interestingly, we're starting to narrow the issue down. It has to do with how we're handling the Contact field. Upserting to Contact works - for instance, if someone creates a new record. However, reading from Contact no longer seems to work - and the lookup (posted above) requires reading from Contact.
If that's the case, then perhaps a final bit of information - that yes, they have just updated us to Winter release - might mean that their enforcement now includes truly restricting "read" (which may be interpreted as edit) of Contact records through Sites.
Can anyone confirm/deny that this is the case?
Thanks!
--Dave
Create permission requires read. So if you have create on Contact object you also give read permission.
Did you create a case with Support?
Hi Bulent,
Thanks for your reply. We have connected with support, and are awaiting more information. After spending the better part of a week poking through it, it looks like a combination of two things (written by Glen C., a developer on our team):
1. The population of a standardController object seems to have changed and related fields are not populated unless specifically bound by a{!fieldname} reference on the page. Text fields however are still referanceable without being bound. I'm not referring to a second level reference such as Contact.relatedfield__r.somefield but Contact.Accountid.
This is a change from previous functionality and the documentation and release notes made no mention of the change. Easy enough to fix once I realized the problem. Btw it didn't throw any error but System.debug
lines did catch the error. I reproduced this behavior with a small one page app bound to Contact and a controller extension trying to read the Accountid ( a reference field) related field. This failed with an error that the referenced field was not retrieved in the SOCL query. But if I changed the referenced field to a text field such as phone number that worked with no problem.
2. The <apex:composition template="{!$Site.Template}"> tag stopped working on our site. The pages would "load" without error but wouldn't render the body content, we just got a blank page. I removed the <apex:composition template="{!$Site.Template}"> tag from the page and replaced it with the content tags of the site template thus
<c:CT_App_Styles />
<script src="{!$Resource.checkboxlimiter}" type="text/javascript"/>
<apex:insert name="CT_App_Header">
<c:CT_App_Header />
</apex:insert>
<!--<apex:insert name="mainContent"/>--> --->
body code that would be inserted by the above tag
<----- <apex:insert name="CT_App_Footer">
<c:CT_App_Footer />
</apex:insert>
I wish to emphasize that this was all working code with no issues prior to the Winter 10 release.
If I can supply any other information please let me know
So I think it's an issue with the composition tag..I found the same problem after the new release...
This simple VF page still works - note I am just using a StandardController, no Extensions etc...:
<apex:page standardController="Position__c" title="Job Details" showHeader="false" standardStylesheets="false">
<apex:form >
<!-- The site template provides the site layout and style -->
<!-- Breadcrumb link back to the search page -->
<apex:outputLink value="<- Back to Search" onclick="top.history.go(-1);return false;" />
<br/>
<!-- Job details -->
<apex:pageBlock>
<h3><apex:outputField value="{!Position__c.name}"/></h3><br/><br/>
</apex:pageBlock>
</apex:form>
</apex:page>
But when I add in the apex:composition tag below, it breaks with the following error:
SObject row was retrieved via SOQL without querying the requested field: Position__c.Name
But the tags work fine on every other page when I use a custom controller that has to execute SOQL - just not when I use a standard controller?
<apex:page standardController="Position__c" title="Job Details" showHeader="false" standardStylesheets="false">
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<apex:form >
<!-- The site template provides the site layout and style -->
<!-- Breadcrumb link back to the search page -->
<apex:outputLink value="<- Back to Search" onclick="top.history.go(-1);return false;" />
<br/>
<!-- Job details -->
<apex:pageBlock>
<h3><apex:outputField value="{!Position__c.name}"/></h3><br/><br/>
</apex:pageBlock>
</apex:form>
</apex:define>
</apex:composition>
</apex:page>
Hi Steve
I think the solution you are referring to is when you want to reference a field in a controller/extension, but that field isn't currently displayed on the page.
The issue here is (I believe) different - if you are using the standard controller, and referencing a single Id, you shouldn't need to include any hidden fields - the controller should just make them available...
I had to create an extension that executed a SOQL statement with the fields I wanted, and then use that for displaying the data - annoying, as it rather defeats the purpose of the Standard Controllers, but easy to implement - let me know if you need the code for that...
What you say about the standard controller is borne out by the removal of the apex:composition tag that seemed to be interfering with the VF page. However, it still leaves the question why that particular composition tag interferes with the display of standard custom fields? My understanding of the composition tag is to define a site template, yet fields stop displaying as soon as the tag is added? In my example it occurs when the VF position details Page is called from the public jobs page using the following tag:
<apex:outputLink value="nav_PublicJobsDetailsPage?id={!position__c.Id}"
id="theLink">{!position__c.Name}>
</apex:outputLink>
This is based on the documentation example provided by SF for using sites.
Hmm... seems like a lot of people are having this issue.
I wonder if anyone from SF has acknoledged that there might be a bug in the Winter 09 release that causes the composition tag to interfere with the display of standard custom fields?
there is a bug on using standard controller and dynamic page templates.
the current workaround is to directly reference the page template rather than using the site template expression