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
EmsEms 

Data in table working fine in VisualForce page, NOT showing in sites

I have a data table exposing Opportunity fields on a visual force page. It works fine within Salesforce.  I created a site, set the page as the home page for my site, and no data shows.  The page title and column headers show fine, so I know it's not a security issue with the entire page.

 

I have set the field accesibility of every field I am referencing, used the Public Access button to make sure the opportunities object is readable, and checked everything I can think of.

 

The only thing that I can imagine is affecting this is that I am using record types on Opportunities, but I can't find any settings to change behavior based on record types. My visual force code doesn't reference record types at all, and all records are shown when I access the page within salesforce.com

 

Any suggestions would be greatly appreciated - I'm excited about getting my first site up and running, and if I can't expose data it won't be much use!

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

the problem is the RecordSetVar attribute. I believe it's automatically using the latest list view definition on the related object. And for Site there is no latest used list view definition. 

 

I recommend using a custom controller 

Message Edited by Bulent on 12-11-2009 03:50 PM

All Answers

BulentBulent
do you have private sharing on opportunity object?
EmsEms

Sharing Settings on Opportunity are set to Public Read/Write.

 

I changed one of the columns in my table to present static text, and it had no effect on the table in sites but I saw the change within sfdc. Here's my code:

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Opportunity" recordSetVar="items">
<apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}" />
    <h1>Auction Catalog</h1>
        <br/><br/>
   
    <apex:dataTable value="{!items}" var="pitem">
        <apex:column headerValue="Item Number">
            <apex:outputText value="{!pitem.Item_Number__c}"/>
        </apex:column>
        <apex:column headerValue="Item Name">
            <apex:outputText value="{!pitem.name}"/>
        </apex:column>
        <apex:column headerValue="Description">
            <apex:outputField value="{!pitem.Description}"/>
        </apex:column>
    </apex:dataTable>
   
    <br/>
   
</apex:page>

BulentBulent
you might want to check the default record type for your site via the site public access settings.
EmsEms

I'm no longer thinking that this is a security issue.  I modified my page NOT to use RecordSetVar, instead to look at a single record passed in via URL parameter. This exposes the data just fine:

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false"
standardController="Opportunity" >
<apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}" />
    <h1>Auction Catalog</h1>
    <p>Name:
    <apex:outputField value="{!opportunity.name}"/> <br/>
    Description:
    <apex:outputField value="{!opportunity.description}"/>
    </p>


</apex:page>

 

So I think I'm doing something wrong with the list of all opportunities... any suggestions greatly appreciated!

jhuangjhuang
I don't believe you can expose standard object fields using the InputField tag.  What you could possibly do is create a custom object with the same fields you want to capture if you want to update existing records; then, using Apex code, you can write the values to the Opportunity (or other standard object fields).
BulentBulent

Site allows you create and read Standard Objects (except products, price books and ideas: you only get read access).

 

You would need to authenticate the site visitors with customer or partner portal in order to get additional (edit/delete) access on standard objects. 

EmsEms

OK - I have MASSIVELY simplified what I am trying to do and am still having trouble.

 

Statement of problem:

 

Custom Object Catalog_Item__c

Trying to display a list of all records on site. Permissions is set appropriately. Can see data from logged in (ie na7.salesforce.com/apex/Catalog) but see NO data on site (bnai-shalom.force.com/catalog)

 

When I make a single record page and specify an ID, I CAN see data from the site (so I don't think it is a permissions problem)

 

I am only using outputText, so I don't think it is an authentication problem.

 

PLEASE HELP!!!

 

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" standardController="Catalog_item__c" recordSetVar="items"> <apex:stylesheet value="{!URLFOR($Resource.styles, 'styles.css')}" /> <h1>Auction Catalog</h1> <apex:dataTable value="{!items}" var="pitem" > <apex:column headerValue="Item Number"> <apex:outputText value="{!pitem.Item_Number__c}"/> </apex:column> <apex:column headerValue="Item Name"> <apex:outputText value="{!pitem.Item_Title__c}"/> </apex:column> </apex:dataTable> </apex:page>

 

BulentBulent

the problem is the RecordSetVar attribute. I believe it's automatically using the latest list view definition on the related object. And for Site there is no latest used list view definition. 

 

I recommend using a custom controller 

Message Edited by Bulent on 12-11-2009 03:50 PM
This was selected as the best answer
EmsEms

So why is this exactly how the force.com workbook explains to make a site? - Tutorial #8 displays a list of products by using a recordsetVar.

 

I guess I can write my own controller, but this is so tantalizing - why can't it just work the way it's documented?

 

Thanks all

 

 

debikendebiken
Hi, I'm having the same problem with a custom controller on the Lead object.  When attempting to display the data through sites technology I am unable to see certain fields.  I have checked the field accessibility...you mention checking public access settings for sites?  I'm not finding these security settings...
EmsEms

Go to Setup/Develop/Sites

Click the label of your Site

Click the Public Access Settings button

 

Make sure you are including all the fields you need to display or access in the SOQL query in your controller!

 

Good luck,

Emily