You need to sign in to do that
Don't have an account?
System.Exception: Internal Salesforce.com Query Error - Diagnosis / Tentative Conclusion
I have an APEX ControllerExtension class which overrides the Edit button. To make life easy for me, I use a Dynamic SOQL statement to fetch all columns from the Opportunity sObject so they are available for display in the VF page should I need them
That is, I create a SOQL statement of the form:
'select field1,field2, ...fieldn from Opportunity where id = :oppId'
One of my fieldx is a formula field using this formula:
'First name Last name= ' & $User.FirstName & ' ' & $User.LastName & BR() &
'User.UserType= ' & TEXT($User.UserType) & BR() &
'UserRole.Name=' & $UserRole.Name & BR() &
'UserRole.PortalType=' & TEXT($UserRole.PortalType) & BR() &
'Profile.LicenseType=' & TEXT($Profile.LicenseType) & BR()
If this fieldx is included in either a dynamic SOQL or static SOQL expression, at run time, when executed from the Partner Portal by a partner Portal user, I get:
System.Exception: Internal Salesforce.com Query Error
and not much else.
Obviously, there is something this formula field does that messes up the SOQL call -- although the field displays fine on the standard controller user interface detail page (View).
I selectively commented out parts of the formula to determine which parts cause the Internal Salesforce.com Query Error
TEXT($User.UserType) - If present in the formula field, Internal Salesforce.com Query Error occurs
TEXT($UserRole.PortalType) - If present in the formula field, Internal Salesforce.com Query Error occurs
All other expressions in the formula field don't cause an error.
I can work around this particular problem but in general, any sObject field should be queryable through SOQL and not depend on the formula expression. Why it works through the standard controller UI and not through a controller extension SOQl (static or dynamic) is unknown.
Hopefully, this will help someone out in the future
I am also now receiving this error message intermittently, on a query that was working perfectly fine before.. It's a normal query in a VisualForce page (not via portal or Sites).
Sometimes it works, and somtimes it doesn't. I have the feeling that this error message is a more generic message that will be applied to any query that something does wrong with..