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
VijayasaharanVijayasaharan 

Unable to insert into custom object from my visual force page under "Sites"

Hi
I create a new site which I would like to have my end users to access without SF login. I created a custom object and I was able to display the records but the insert isn't working. I get the message below 

"Authorization Required  You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it"
 
<apex:page standardController="OnboardingInfo__c" tabStyle="OnboardingInfo__c">
    <apex:form>
    
     <apex:pageBlock>
         
        <apex:pageBlockSection columns="1">

        <apex:inputField  value="{!OnboardingInfo__c.Name__c}"/> 
        <apex:inputField  value="{!OnboardingInfo__c.Technical_Contact__c}"/>
        <apex:inputField  value="{!OnboardingInfo__c.Field1__c}"/>
        <apex:inputField  value="{!OnboardingInfo__c.Module1__c}"/>
        </apex:pageBlockSection>
         <apex:pageBlockButtons >
        
                <apex:commandButton action="{!save}" value="Save"/>
                </apex:pageBlockButtons>
        
            </apex:pageBlock>
        </apex:form>
    <apex:pageBlock>
        THIS IS A TEST
        
        <apex:listViews type="OnboardingInfo__c"/> 
     </apex:pageBlock>
</apex:page>

I have granted Create Read Edit permission under the "Remote Site Settings => Profile" for the Site that I created. Please help me in letting me know the permission that I am missing.

Ideally I would like to show the Add / Edit Screen that you get in out of box Salesforce object inside the Site (I am assuming we need to use VF page for this).

Is there a way we can add the entire tab to the Visual force page inside the "Site" created?
Best Answer chosen by Vijayasaharan
VijayasaharanVijayasaharan
For people who stumble on to this page, here are the issues

1) If you go to setup-> sites and click on the site label, you will go to Site Detail. Click on the public access setting and ensure all the fields has access 
2) Once you click save, the page will be redirected to the default page detail view and you wouldn't necessary have access to this detail page. So you need to redirect users to a specific page using page reference. 
3) Also create a custom class to handle the page redirection and save operation

Let me know if there are any questions.

All Answers

VijayasaharanVijayasaharan
++ I checked the permission for the Visual force page and I do see that as part of the General User's default form profile. Also the fact that the List View of all records inside the custom object works OK (<apex:listViews type="OnboardingInfo__C"/>
VijayasaharanVijayasaharan
For people who stumble on to this page, here are the issues

1) If you go to setup-> sites and click on the site label, you will go to Site Detail. Click on the public access setting and ensure all the fields has access 
2) Once you click save, the page will be redirected to the default page detail view and you wouldn't necessary have access to this detail page. So you need to redirect users to a specific page using page reference. 
3) Also create a custom class to handle the page redirection and save operation

Let me know if there are any questions.
This was selected as the best answer