I have created simple site that create a new case. ERROR Logo

Note :

  • I have given the Site permissions Visualforce page,Controller ,Lead Object and Case Object.
  • While execute the site Lead is created similarly I tried to create a new case it not happens.
  • I have given the case Object create permission but why it is not created Can someone please help me. While executing the site it showing the error:

Visualforce Page

<apex:page controller="Controller" action="{!init}" showHeader="false" sidebar="false">
        <apex:pageBlock title="Request Listener"></apex:pageBlock>          

Controller :

     public with sharing class Controller
                public PageReference init()
                // Lead l1 = new Lead(FirstName='first name1',LastName = 'lead last name',phone ='9876543210');//testing
                 //insert l1;   testing           
               Case c = new Case(Subject = 'Subject Test',Description ='Description Test');
              insert c;
               catch(exception e){}
                RETURN null;
  • 1
    where are you redirecting after saving the case or lead ?Also very improtant is to preview the page as admin and add pagemessage so that error is visible .Any error in site will go to unauthorized page if thats set as error page Commented Jun 24, 2014 at 7:59
  • I have click the preview at time(Lead/Case is created) it not showing any error.The URL site URL execute different another browser at the time the error it came(At the time Lead is created but Case is not creted) Commented Jun 24, 2014 at 8:11

2 Answers 2


It is not related to permissions or profile if they are correct as you already checked. You are definitely getting an exception in code. There are some exception happening.

You should first try to run the same page by login into Salesforce organisation and check debug logs then.


As @Mohit suggested add pageMessages tag always to possibly see some untrapped errors.

You should try trapping debug logs for "Sites User" via Developer console or Setup > Monitoring > Debug Logs. See what logs are telling you about the error ?

Also try to run the page in admin mode to see if some error shows up.

  • I have tried to admin loin then preview is clicked the not came.Can you please tell me how to use the "pageMessages" Commented Jun 24, 2014 at 10:54
  • I have checked all permission's again once Now it is working for me. Commented Jun 24, 2014 at 13:06
  • Great, where was the gap ? Commented Jun 25, 2014 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .