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
WmWm 

Autorization Required page error on click of Edit

Hi I have created the following site, but I am facing some issues in accessing the site:

 

http://sustainability.dev.cs3.force.com/NewSEForm

 

When I submit the form on the site, I am taken to another page which is controlled by a standard controller. When I click on the edit button, I am taken to the 'authorization required' page although I ahve alredy given the Read, Create and edit permission my my custom object.

 

I am gacing the same issue when I Try to use the can cel button functionality on the first page, I am using the following code for cancel button:

public PageReference Cancel() {
 
      if(UserInfo.getprofileid() == '00eQ0000000LrqAIAS'){
           // After Cancel, navigate to the Walmart Website Home Page:
           PageReference pageRef = new PageReference('www.wal-mart.com');
           pageRef.setRedirect(true);
           return pageRef;
       }else{
           PageReference pageRef = new ApexPages.StandardController(eve).cancel();
           //System.currentPageReference();          
           //new PageReference('/'+aId);

           pageRef.setRedirect(true);
           return pageRef;
      }
   }

Can anybody please provide some pointers on this?

 

Thanks

Wm

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

with sites you can only expose visualforce pages (except couple of standard pages:search, lookup and home page).

Standard controller actions would by default take you to standard pages unless if you extend your controller and capture actions and navigate to your custom visual page, or if you overwrite the action for everyone via the object definition.

 

You can check the developer guide chapter 14 for an example on ho to extend the standard controller for this type of use case.