You need to sign in to do that
Don't have an account?
MC2014
Querying a User within a Public sites page?
I have a public site page form that creates a case and assigns it to the owner that is query within Apex. Since, its is a public site it doesn't query anything from the user object.
Using "Site.getAdminId()" doesn't work in my case, since I am the site administrator that is not what I want.
Using "Site.getAdminId()" doesn't work in my case, since I am the site administrator that is not what I want.
16:09:31.169 (169671978)|SOQL_EXECUTE_BEGIN|[119]|Aggregations:0|SELECT Id FROM User WHERE Name = 'Salesforce Administrators' LIMIT 1 16:09:31.189 (189902826)|SOQL_EXECUTE_END|[119]|Rows:0 16:09:31.190 (190228383)|SYSTEM_MODE_EXIT|false 16:09:31.190 (190383656)|FATAL_ERROR|System.QueryException: List has no rows for assignment to SObject
All Answers
Have you executed the query to ensure that there is a user named 'Salesforce Administrators' ?
Originally that query was within the PageReference save method, so I move it to the constructor and now get the standard site "Authorization Required" page.
Comment out that user query line, and the page load fine. So, some reason that User Object is not open in Sites.