You need to sign in to do that
Don't have an account?
Sumant Hegde
Not able to display list of item in public sites
Hi,
I am trying to display list of records retrieve from SOQL query in my public site.
Tried using <apex:PageBlockTable> and <apex:repeat>. Both work fine when I "preview" it using developer console, but the value will not be displayed on the public site that I have created.
Does it have anything to do with permissions?
Thanks,
I am trying to display list of records retrieve from SOQL query in my public site.
Tried using <apex:PageBlockTable> and <apex:repeat>. Both work fine when I "preview" it using developer console, but the value will not be displayed on the public site that I have created.
Does it have anything to do with permissions?
Thanks,
Thanks for your suggestion.
I have given all the access permission to the guest user in "Public Access Setting'.
Issue is like this
When I use <apex:pageBlockTable> or <apex:repeat> tags, the public site displays the number of rows according to the list size, but the rows will not display any values in it.
I am not sure, what permission/access issue is causing this.
Example1:
This code works. I can display the value of lastName in my vf page.
---------------------------controller-------------------------------------
public class display{
public List<cust_obj__c> ab{get;set;}
public String lastName{get;set;}
public display(){
ab = [SELECT First_Name__c ,Last_Name__c FROM cust_obj__c WHERE First_Name__c = 'test'];
for(Registration__c a:ab){
lastName = a.Last_Name__c;
}
}
}
----------------------------vf code---------------------------------
<apex:page controller="getURLId">
<apex:pageBlock >
{!lastName}
</apex:pageBlock>
</apex:page>
Example2:
This is not working. It gives table with blank rows.
------------------------controller----------------------------------
public class display{
public List<cust_obj__c> ab{get;set;}
public String lName{get;set;}
public display(){
ab = [SELECT First_Name__c ,Last_Name__c FROM cust_obj__c WHERE First_Name__c = 'test'];
}
}
----------------------------vf code----------------------------------------------
<apex:page controller="getURLId">
<apex:pageBlock >
<apex:pageBlockTable value="{!ab}" var="item">
<apex:column value="{!item.First_Name__c}"/>
<apex:column value="{!item.Last_Name__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
The second example works directly with the object and its fields. Which leads me to ask you to check Field Level Security for that Site Profile.
I just checked the Field-Level Security for site profile with respect to the custom object. All the fields have been given read-access and some are given with write access also.
are you using the right controller? <apex:page controller="getURLId"> means that the name of your controller is getURLId. However, the class you shared is called display.
Is that right?
I would go with
Yes I am using right controller. I didn't want to paste my exact code in here, so i changed some of the names while pasting the code.
But in my code, controller name is "getURLId".
Controller Visualforce page I still think it is a permissions issue on your end. Sorry I have not been much help.
Yes, I also feel that it is permission issue, but I am not able to find out what is that.
I have checked following permissions for my guest user profile
1. Custom Object Permissions for my object "cust_obj__c" and gave Basic access and Data administration permissions
2. Field-level access for the fields of "cust_obj__c" and gave Read and Edit access to all the fields.
Do I need to check any other permissions?
Still same issue.
Take a breather and start the final sanity check.
- Check that you are modifying the right site's settings.
- Check that you are modifying or using the right visualforce page in the site.
- The site's profile must have read access to your custom object.
- The site's profile must have read access to each of the custom object's fields, checked via Field Level Security of the Site profile.
- OWDs set to Public Read/Write.
Good luck!I have done all these checks and everything is exactly same as you said.
Unfortunately, the issue is still the same.
Thanks
You were right. After lot of research, i found that even though i have given all these permissions, "View All Data" under Org-Wide Permissions, for the guest user profile is not getting selected because of which I am not able to see the data on public site.
Unfortunately, I didn't find any way to mark "View All Data" checkbox for the guest user.
I am trying all these in my salesforce developer edition.
Could you please let me know where can I cnage this permissions?
My object is called Apex, see below.
I have done that also.
I am using "Registration" object and the permssion looks like this.
Even though I have saved these permissions, if I go to "Sharing setting" and look check the profile permissions, it looks like this.
"Register Profile" is a guest user profile which I have created for my public site. For that user Org-wide permissions are not selected even though I have given the permissions as I showed above.
My email address is stebugz@gmail.com.