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
dshpadshpa 

No access to SFDC objects in production

I try to create my first Force.com site. It works perfectly in sandbox, but in production I can't access any SFDC object. In my case I need aceess to Contacts (only to read, no changes). I check Field-Level Security, set Read and Create permissions for Contact object in Public Access Settings and created a simplest default VF page (below).

 

 

<apex:page standardcontroller="Contact" recordSetVar="Contacts" >
	<apex:form >
		<apex:pageBlock title="Contacts">
	      	<apex:pageBlockTable value="{!Contacts}" var="Contact">
	            <apex:column headerValue="Name">
	               	{!Contact.Name}
	           	</apex:column> 
	      	</apex:pageBlockTable>
	   	</apex:pageBlock>
	</apex:form>
</apex:page>

 

 

When I open my site (this page), the list on the page is empty. When I set up Tab Settings for Contacts in "Default On" and try to click tab "Contacts" I get "Authorization Required" page. In Preview as Admin mode there is an additional info: "Page not allowed fo profile:/it/003/o". How can it help me? The similar situation is for any other SFDC object. I can't access nothing! I searched Community but didn't found any working solution. I understand, that the problem is in absent permissions for something, but don't know what to do else.

Ryan-GuestRyan-Guest

In Sites, you aren't allowed to view the standard pages as a guest user (like 003/o)

 

If you want to use a visualforce page to view a record, you'll need to pass in the id into the query string.

 

Example:

 

 

http://mysite.force.com/apex/conPage?id=003000000000001

b-Forceb-Force

You can access this Standard Object information from site and manipulate DML , Prior to it yiu need record Id

 

Thanks,\

Bala

dshpadshpa

Thanks to all who answered! I've read answers with attention but... I try to describe the problem once again. In the controller of a site VF page I want to select some Contacts on some conditions. But testing this I found that even SOQL 

 

 

[select Id from Contact]

 

 

returns nothing despite any Access Settings for the site. Eventually I decided to get Contacts at all in any way. And I can't!

 

You advise to set id in URL. That is wonderful for a single record. But what about set of records in Apex? The problem is actual so far.

dshpadshpa

Bala Wani, I tested DML as you proposed. Unfortunately with the same result. I used the following simple code:

 

 

*** Page ***

<apex:page controller="TestContactsController" >
	<apex:outputText >{!NumberOfContacts}</apex:outputText>
</apex:page>

*** Controller ***

public with sharing class TestContactsController {
	public Integer NumberOfContacts {
		get {
			List<SObject> Contacts = Database.query('select Name from Contact limit 100');
			return Contacts.size();
		}
	}
}

 

And I got 0, not 100 as excepting. When I try the page as VF page, not as a site, I get 100.