2

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>

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?

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 (

1 Answer 1

1

I have never managed to get a vf page working on the site with only standard controller .I have always use extension class to redirect users to the custom page after save .

So the workaround could be use a custom extensions controller and rewrite the save logic in page reference method

public OnboardingInfo__c onboarding {get {return new OnboardingInfo__c();}set;}

public pagereference save(){
   insert onboarding;
   return null;
}
1
  • Thanks Mohith. I hoped that was not the case. Time to learn on creating controllers I think :-) I used your code as is and it does create a new record, just that its not taking any values from the page and that its defaulting all values to null.. public class custom_Onboarding { public OnboardingInfo__c onboarding {get {return new OnboardingInfo__c();}set;} public pagereference save(){ upsert onboarding; return null; } }
    – Vijay
    Commented Mar 22, 2017 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .