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
Krishna_Krishna_ 

regarding Sites

Hi to all,

I have 2 questions.,

I am creating a site  to call the Visual force page.

The visual force page contains system objects like Contacts.,

Now i am added two fields of contact

My first question How to add Visual force page to "Contacts related list of Notes & attachments"

 

&

the second question is,

I am connected visualforce page to SITES. & run the specific URL,

 

& save the two filelds to contact it shows the below error message. but the values are added to contacts.

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.

How to handle this one?????

 

my sample code is:

 

<apex:page standardController="Contact">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
            </apex:pageBlockButtons>
           <apex:pageBlockSection >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel id="lastname" value="Last Name" for="Visual">
                    </apex:outputLabel>
                    <apex:inputText value="{!Contact.lastname}" />
                </apex:pageBlockSectionItem>
             </apex:pageblockSection>
             <apex:pageblockSection >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel id="Department" value="Department" for="visual"></apex:outputLabel>
                   <apex:inputText value="{!Contact.Department}" />
                </apex:pageBlockSectionItem>
             </apex:pageBlockSection>  
           </apex:pageBlock>
    </apex:form>
</apex:page>

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

For #1 there is a similar example in Force Platform Developer Guide Chapter 14

 

For #2 you need to go to setup> app setup>create>objects and then overwrite the view action with your own visualforce view page 

 

All Answers

BulentBulent

I'm guessing that you are using the standard controllers for your visualforce page.

the default save action of the standard controller is to save the record and show the record details page. The details page is a standard page, not a visualforce page, and you can not expose standard pages via sites (only visualforce pages).

You have 2 options:

1- extend the standard controller so that you can capture the save action and after save redirect to your own visualforce page (this option applies to only your specific site)

2- overwrite the save action on the object definition so that save will be handled by the visualforce page (this option applies to all profiles + sites). 

dhubbarddhubbard
I'm having a similar problem. I've created a lead entry page for our employees who are not on Salesforce to submit leads to our sales team and am running into the you must login page. You listed 2 options for handling these, but how do we do either of them?
BulentBulent

For #1 there is a similar example in Force Platform Developer Guide Chapter 14

 

For #2 you need to go to setup> app setup>create>objects and then overwrite the view action with your own visualforce view page 

 

This was selected as the best answer