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
Krrish GopalKrrish Gopal 

I want to see case detail at salesforce site


Apex Class
public class displaycase {
public string getcasetype{get;set;}
public  void displaycase ()
{
    
}
public list<case> caselst{get;set;}


public list<selectoption>getcasestatus()
{
    list<selectoption>selectopt=new list<selectoption>();
    selectopt.add(new selectoption('Open','Open'));
    selectopt.add(new selectoption('Closed','Closed'));
    return selectopt;
}
public void displaycaselist()
{
    caselst=new list<case>();
   caselst=[SELECT CaseNumber,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Subject,Type FROM Case where status=:getcasetype];
}
}
Visualforce page
<apex:page controller="displaycase">
 <apex:form id="frm">
 <apex:selectList size="1" value="{!getcasetype}" >
 <apex:selectOptions value="{!casestatus}"> </apex:selectOptions>
 <apex:actionSupport event="onchange" action="{!displaycaselist}"/>
 </apex:selectList>
 <apex:outputLabel id="pnl1" >
 <apex:pageBlock >
 <apex:pageBlockTable value="{!caselst}" var="cse">
 <apex:column >
      <apex:outputLink value="/apex/TabbedVisualforcePage?Id={!cse.id}">{!cse.CaseNumber}</apex:outputLink>
 </apex:column>
 <apex:column value="{!cse.Subject}"/>
 <apex:column value="{!cse.Type}"/>
 <apex:column value="{!cse.Priority}"/>
 <apex:column value="{!cse.Reason}"/>
 <apex:column value="{!cse.Status}"/>
 <apex:column value="{!cse.IsEscalated}"/>
 <apex:column value="{!cse.IsClosed}"/>
 <apex:column value="{!cse.ClosedDate}"/>
 </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:outputLabel>
 </apex:form>
</apex:page>
Page shown list of cases successfully but when I'm trying to click on case number, code through an Authorization Required error.
 
Pankaj_GanwaniPankaj_Ganwani
Hi,

Please check whether TabbedVisualforcePage is added in profile which is assigned to site user. If not, assign this page to profile.
Krrish GopalKrrish Gopal
It's added at Guest user profile but still having Authorization Required error.
Pankaj_GanwaniPankaj_Ganwani
Hi,

Please check in debug logs for page controller(TabbedVisualforcePage) wheter you are getting an exception or not.
Krrish GopalKrrish Gopal
26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
16:37:43.021 (21284742)|EXECUTION_STARTED
16:37:43.021 (21319943)|CODE_UNIT_STARTED|[EXTERNAL]|06690000001kcl7|VF: /apex/Unauthorized
16:37:43.303 (69052294)|CUMULATIVE_LIMIT_USAGE
16:37:43.303|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:37:43.303|CUMULATIVE_LIMIT_USAGE_END

16:37:43.069 (69085719)|CODE_UNIT_FINISHED|VF: /apex/Unauthorized
16:37:43.070 (70156781)|EXECUTION_FINISHED
Found nothing other then  CUMULATIVE_LIMIT_USAGE_END
Pankaj_GanwaniPankaj_Ganwani
Hi,

Please check whether the page is included in site visualforce pages(not in profile). If so, add it.
Use apex:page attributes to <apex:page tag such as sidebar="false" showheader="false" id="pg1" tabStyle="Case" cache="false"  for TabbedVisualforcePage.
Make sure the controller of this page should be set as without sharing.
 
Krrish GopalKrrish Gopal
Checked Page is included in site visualforce pages.

TabbedVisualforcePage
<apex:page standardcontroller="Case" sidebar="false" showHeader="false" id="pg1" tabStyle="case" cache="false">

 
Krrish GopalKrrish Gopal
My TabbedVisualforcePage
 
<apex:page standardcontroller="Case" sidebar="false" showHeader="false" id="pg1" tabStyle="case" cache="false">

   <style>
      .activeTab {background-color: #20B2AA; color:white; background-image:none}
      .inactiveTab { background-color: #90EE90; color:black; background-image:none}
   </style>
   <apex:tabPanel switchType="client" selectedTab="tabdetails" id="CaseTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">   

<!--  <apex:tab label="Detailed Information" name="MyCaseView">
         <apex:include pageName="MyCaseView"/>
      </apex:tab>-->
      <apex:tab label="Detailed Information" name="CaseDetails" id="tabdetails">
         <apex:detail relatedList="false" title="true"/>
      </apex:tab>
      <apex:tab label="Field Service Report" name="Field_Service_Report__r">
         <apex:relatedList subject="{!case}" list="Field_Service_Report__r"/>
      </apex:tab>
      <apex:tab label="Job Warranty" name="Job_Warranty__r">
         <apex:relatedList subject="{!case}" list="Job_Warranty__r"/>
      </apex:tab>
      <apex:tab label="Related Cases" name="Cases">
         <apex:relatedList subject="{!case}" list="Cases"/>
      </apex:tab>      
      <apex:tab label="Case Comments" name="CaseComments">
         <c:CaseComments CasesId="{!Case.Id}"/>
      </apex:tab>      
      <apex:tab label="Solutions Detail" name="CaseSolutions">
         <apex:relatedList subject="{!case}" list="CaseSolutions"/>
      </apex:tab>      
      <apex:tab label="Contact Roles" name="CaseContactRoles">
         <apex:relatedList subject="{!case}" list="CaseContactRoles"/>
      </apex:tab>      
      <apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
         <apex:relatedList subject="{!case}" list="OpenActivities"/>
      </apex:tab>
      <apex:tab label="Activity Histories" name="ActivityHistories">
         <apex:relatedList subject="{!case}" list="ActivityHistories"/>
      </apex:tab>
      <apex:tab label="Approval Histories" name="ProcessSteps">
         <apex:relatedList subject="{!case}" list="ProcessSteps"/>
      </apex:tab>
      <apex:tab label="Notes And Attachments" name="CombinedAttachments">
         <apex:relatedList subject="{!case}" list="CombinedAttachments"/>
      </apex:tab>
      <apex:tab label="Case Histories" name="CaseHistory">
         <c:CaseHistory CasesId="{!Case.Id}"/>
      </apex:tab>
   </apex:tabPanel>
</apex:page>