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
lucaspalucaspa 

Save Button redirects user to page that needs authorization

I have a simple page set up to take in candidate data, and it works perfectly fine. But when save is clicked, it moves me from http://pjl-developer-edition.na15.force.com/ExternalSurvey to http://pjl-developer-edition.na15.force.com/ExternalSurvey/a00i0000005BYLR  and then I get the Authorization Required  error. The records on the candidate database are still updated and the new information is added perfectly well. How do I get this to save and just clear the data and stay on the page, or change the redirect to go to a thank you page that would be publicly available? Code is below! This is my first post so im not quite sure how to get it in a "code box" , sorry about that! Thanks

 

<apex:page standardController="Candidate__c"  >

 

    <apex:form >

        <h1>

        First Name: <br/>

        <apex:inputField value="{!Candidate__c.First_Name__c}" />

        <br/><br/>

        Last Name:<br/>

        <apex:inputField value="{!Candidate__c.Last_Name__c}" />

        <br/><br/>

        Email: <br/>

        <apex:inputField value="{!Candidate__c.Email__c}" />

        <br/><br/>

        Phone:<br/>

        <apex:inputField value="{!Candidate__c.Phone__c}" />

        <br/><br/>

        School:<br/>

       <apex:inputField value="{!Candidate__c.School__c}" />

       <br/><br/>

        GPA:<br/>

        <apex:inputField value="{!Candidate__c.GPA__c}" />

        <br/><br/>          

        </h1>

 

        <apex:commandButton action="{!save}" value="Save record"/>

        <br/>

        <apex:commandButton action="Cancel" value="Cancel"/>

        <br/>

    </apex:form>           

</apex:page> 

 

 

Ashish_SFDCAshish_SFDC

Hi Lucaspa, 

 

As you are using Standard Controller, it will run the page in the User Mode of Access and Permissions. 

Check the user permissions. 

To see the error, log into your instance and access the page (by using the /apex/PageName url) and try inserting the record.  Any exceptions would then be shown to you on the authenticated session.

Another option is to have a try / catch block in your controller code that will email the exception to you.

 

Regards,

Ashish

 

 

Devender MDevender M
page needs authorization because on save it is redirecting to the Candidate detail page. as the permission is missing for that object it says authorization need.
You can write the custom controller and write a custom save method. and show the success message and display saved field.