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 

Related list at VF Page that is being accessed via guset user at saleforce site

Hi,
I wanted to confirm it is possible to display the Field_Service_Report__r(custom object), 
Notes and Attachments, OpenActivities and other related list on a VF page that is being accessed via guset user at saleforce site, in admin mode it works fine.

My VF Page
<apex:page action="{!CheckSession}"  controller="CaseDetailController" showHeader="true" cache="false" sidebar="true" tabStyle="Case">
    <chatter:feedwithfollowers entityId="{!objcase.Id}"/>
    <apex:form >
        <apex:pageblock mode="maindetail" title="Case Detail">
            <apex:outputpanel >
                <apex:pageblocksection title="Case Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.CaseNumber}"/>
                    <apex:outputfield value="{!objcase.OwnerId}"/>
                    <apex:outputfield value="{!objcase.Origin}"/>
                    <apex:outputfield value="{!objcase.Priority}"/>
                    <apex:outputfield value="{!objcase.Status}"/>
                    <apex:outputfield value="{!objcase.Stage__c}"/>
                    <apex:outputfield value="{!objcase.Type}"/>
                    <apex:outputfield value="{!objcase.Reason}"/>
                    <apex:outputfield value="{!objcase.CreatedDate}"/>
                    <apex:outputfield value="{!objcase.ClosedDate}"/>
                    <apex:outputfield value="{!objcase.Site__c}"/>
                    <apex:outputfield value="{!objcase.AssetId}"/>
                    <apex:outputfield value="{!objcase.AccountId}"/>
                    <apex:outputfield value="{!objcase.ParentId}"/>
                    <apex:outputfield value="{!objcase.Is_Expenses_Claimed__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Contact Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.ContactId}"/>
                    <apex:outputfield value="{!objcase.Contact.Phone}"/>
                    <apex:outputfield value="{!objcase.Contact.MobilePhone}"/>
                    <apex:outputfield value="{!objcase.Contact.Email}"/>
                    <apex:outputfield value="{!objcase.Contact.Fax}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Description Information" showheader="true" collapsible="true" columns="1">
                    <apex:outputfield value="{!objcase.Subject}"/>
                    <apex:outputfield value="{!objcase.Description}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Web Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.SuppliedCompany}"/>
                    <apex:outputfield value="{!objcase.SuppliedEmail}"/>
                    <apex:outputfield value="{!objcase.SuppliedName}"/>
                    <apex:outputfield value="{!objcase.SuppliedPhone}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="I&C Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.P_O_Number_I_C__c}"/>
                    <apex:outputfield value="{!objcase.P_O_Date_I_C__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Case Assignment" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.Service_Center__c}"/>
                    <apex:outputfield value="{!objcase.Engineer_Vendor__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="System Information" showheader="true" collapsible="true" columns="2">
                        <apex:outputfield value="{!objcase.CreatedById}"/>
                        <apex:outputfield value="{!objcase.CreatedDate}" id="createddate" label="Created Date"/>
                        <apex:outputfield value="{!objcase.LastModifiedById}"/>
                        <apex:outputfield value="{!objcase.LastModifiedDate}"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
</apex:form>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="Field_Service_Report__r"/>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="CombinedAttachments"/>
 <apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="OpenActivities"/>
 <c:CaseComments CasesId="{!objcase.Id}"/>
 <c:CaseHistory CasesId="{!objcase.Id}"/>
 </apex:page>
 
My APEX Controller

public class CaseDetailController 
{
   public case objcase{get;set;}
   public CaseDetailController ()
   {    
       
   }
   public pageReference CheckSession()
   {
             objcase = new case();
             objcase = [SELECT AccountId,AssetId,BusinessHoursId,CaseNumber,ClosedDate,CommunityId,ContactId,Contact.Name,Contact.Phone,Contact.MobilePhone,Contact.Email,Contact.Fax,CreatedById,CreatedDate,Created_By__c,CreatorFullPhotoUrl,CreatorName,CreatorSmallPhotoUrl,Description,Engineer_Vendor__c,HasCommentsUnreadByOwner,HasSelfServiceComments,Id,Invoice_Date__c,Invoice_Number__c,IsClosed,IsDeleted,IsEscalated,Is_Expenses_Claimed__c,LastModifiedById,LastModifiedDate,LastReferencedDate,LastViewedDate,Origin,Other_Problem_Reported__c,OwnerId,ParentId,Priority,Problem_Reported__c,P_O_Date_I_C__c,P_O_Number_I_C__c,Reason,Remark__c,Service_Center__c,Site__c,SLAViolation__c,Stage__c,Status,Subject,SuppliedCompany,SuppliedEmail,SuppliedName,SuppliedPhone,SystemModstamp,Type FROM Case where id=:apexpages.currentpage().getparameters().get('id') limit 1];
       return null;
   }
   
}

 
SonamSonam (Salesforce Developers) 
The level of access to the guest user depends on his profile setting which you will have to update if you wish to provide more access that is currently available - http://www.salesforce.com/us/developer/docs/workbook_siteforce/Content/siteforce_guest_profile.htm
Krrish GopalKrrish Gopal
At profiel level guest user have read and create access to following related lists object but below apex tag will not shown required result at salesforce sites(when I'm preview in admin mode it works fine but when I click on web site link and open my VF page I'm getting an error msg "Authorization Required".

<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="Field_Service_Report__r"/>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="CombinedAttachments"/>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="OpenActivities"/>
SonamSonam (Salesforce Developers) 
You will need to give the access permissions through the Public Access Settings from site details page for the visulaforce page and objects for the site guest users to access them on site - please confirm if you have done this step.
Krrish GopalKrrish Gopal
Yes, I had already done this step. As per my understanding from last few days after a lot of search on this subject i.e. salesforce sites, I think without defining apex controller we can't view and create new record for related list object at saleforce site(Site created through Menu->Setup->Sites create aVF page for case detail and I also want to accesss case related list without defining any apex controller like in admin mode it's working) but we can easly view and crete records for related list without definingh any apex controller.