I am trying to debug a visual force page that fails with a generic "Error: Error occurred while loading a Visualforce page."
I have set the debug log to the finest settings possible, but all it gives me is this:
16.0 APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,INFO;DB,FINEST;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,FINER;WORKFLOW,INFO
08:01:04.034 (34312000)|EXECUTION_STARTED
08:01:04.034 (34540000)|CODE_UNIT_STARTED|[EXTERNAL]|066700000004clj|VF: /apex/Exception
08:01:04.068 (68281000)|VF_EVALUATE_FORMULA_BEGIN|066700000004clj|#{AND(ISPICKVAL($User.UserType,'Guest'), $Site.LoginEnabled)}
08:01:04.081 (81502000)|VF_EVALUATE_FORMULA_END // the rest is all just the error page rendering
08:01:04.081 (81693000)|VF_EVALUATE_FORMULA_BEGIN|066700000004clj|#{NOT(ISPICKVAL($User.UserType,'Guest'))}
08:01:04.081 (81772000)|VF_EVALUATE_FORMULA_END
08:01:04.082 (82687000)|VF_EVALUATE_FORMULA_BEGIN|066700000004clj|#{$Site.Prefix}#{$Label.site.img_path}/force_logo.gif
08:01:04.082 (82862000)|VF_EVALUATE_FORMULA_END
The fact that it says so little, does this give any clue to the possible error? I've got debug comments in the page controller constructor that I am not seeing, so I'm sure it doesn't get as far as the constructor. What can happen pre-constructor?
Some more information about this specific situation that may be relevant: The page has an HTML form on it and renders perfectly when viewed. It only crashes when I post form data to the page.
Update:
This is a Customer Portal page and running the page not through the portal gave this error:
Update failed. First exception on row 0 with id a0G70000004ED4yEAG; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
This is turning into a different question, but does anyone know which permissions to check and how?
To isolate the error I simplified it down to this page:
<apex:page controller="utilController" action="{!init}" standardstylesheets="false" showHeader="false" sidebar="false" doctype="html-5.0">
<head>
<title>Utility Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<h1>{!sourceName}</h1>
<form method="post">
<div>
<label>Product:</label>
<input name="product_code" type="text" size="12" value="{!productCode}" />
</div>
<input type="submit" value="Save Settings" />
</form>
</body>
</apex:page>
served with this controller:
public with sharing class utilController {
public String productCode {get; set;}
public String sourceName {get; set;}
public utilController(){
System.debug('**** Contructor ');
}
public void init() {
Map<String, String> params = ApexPages.currentPage().getParameters();
Input_Source__c source = readSource();
/* is this a form post */
if (params.get('product_code') != null) {
try {
source.Product__c = params.get('product_code');
update source; // throws INSUFFICIENT_ACCESS_OR_READONLY error
}
catch (Exception e) {
System.debug('**** Exception: ' + e.getMessage());
}
}
sourceName = source.Name;
productCode = source.Product__c;
}
private Input_Source__c readSource() {
Input_Source__c source = [select ID, Name, Product__c
from Input_Source__c
where ID = 'a0G70000004ED4yEAG'];
return source;
}
}
Running under Administrator profile a form post works, running under the Customer Portal User profile it throws the error.
Profile access permissions: