function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
iskradeviskradev 

Error occurred while loading a Visualforce page

I'm playing with the following example: http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_custom.htm

 

I created both the controller and the page. However, I see an error: http://i.imgur.com/JxJbnMy.png

 

I have *no* idea what went wrong. The question is how to debug this?

Best Answer chosen by Admin (Salesforce Developers) 
Rahul_sgRahul_sg
I cant open the error screenshot due to security however; I've 1 question.
How are you calling this VF page?
Are you passing any Id?
try passing id like this> in your URL after /apex/vfpagename?id='any valid account id in your org here'

All Answers

Rahul_sgRahul_sg
I cant open the error screenshot due to security however; I've 1 question.
How are you calling this VF page?
Are you passing any Id?
try passing id like this> in your URL after /apex/vfpagename?id='any valid account id in your org here'

This was selected as the best answer
Tim BarsottiTim Barsotti

--Are you trying to access this from Sites? The error message looks like a Sites error message.

 

--Can you pull up the site from /apex/{PageName}? 

 

--Would you post your code an the URL you are using please?

 

Grazitti InteractiveGrazitti Interactive

Hi,

 

Please go through following two solutions, most probably it will solve your problem.

 

1)Are you trying to access this from Sitesif yes then - GOTO Setup --> Manage Users--> Profiles -->select your customer portal profile that logged in user have Click on the edit button on section Enabled Visualforce Page Access and add your Visualforce page to this profile.

 

2). Don'tforget to pass a valid Id in parameter along with the name of Visualforce page

 

/**If this post helps you then please mark it as a solution and don't forget to give me kudo's.***/

 

Thanks

Grazitti

 

iskradeviskradev

Hello, guys. Thanks for the answers. I didn't pass any ids and passing it indeed helped to load the page correctly. However, the question is how do I debug these errors in the future? As the codebase is small, it's not very hard to spot what went wrong, but in the future hunting it down will be a nightmare.

sfdcdev.wordpress.comsfdcdev.wordpress.com
Hello TIm - we are trying to do a 'new' button override usign a VF page.
It works correctly for internal user and for partner portal users.

However, if we create a community and enable partner users to that community and try to click the'new' button from with in the community as the partner user, we get - Error: Error occurred while loading a Visualforce page.

Thank you for the help in advance.
David CheungDavid Cheung
The generic message "Error: Error occurred while loading a Visualforce page" is generated from the out-of-the-box communities or portal Exception page. You can see this configuration through Communities/Manage Communities/<Your Community>/Force.com, Error Page Pages section, and Generic Error Page. This page is displayed whenever an error is thrown from the VF page that your community user is trying to access. Since your VF page is meant for external consumption the idea is to mask as much about the actual error as possible to prevent exposing your org's configuration to the public, which also means it doesn't help during development. However you can edit the Exception page to show the actual error by adding the following block:

<apex:outputText styleClass="title" value="{!$Label.site.error}">
                   <apex:param value="{!$Site.ErrorDescription}"/>
</apex:outputText>

to supplement the messaging display block that's already on the page:

<apex:outputText styleClass="title" value="{!$Label.site.error}">
     <apex:param value="{!$Site.ErrorMessage}"/>
     <!-- this parameter needs to be italic in the site.error label -->
<apex:outputText>

Of course remove the block once you are able to determine the error.
For whatever reason errors encountered on communities VF pages are not logged in the debug log therefore this is the only method to see the error.
Jesus Gonzalez SanchezJesus Gonzalez Sanchez
Thanks David! That's really helpfull! 
Jonathan Meltzer 14Jonathan Meltzer 14
This is fantastic...is there a way to get a line number for the error as well?
Alex SkemprisAlex Skempris
Just a +1 for David. Fantastic solution!

As Jonathan if we can get more info around the error would be really helpful
Muriel P 3Muriel P 3

Thanks David, you gave me a solution there. 

And not for the first time!