I have two pages and one controller all enabled for Site Guest Profile. On page A I have an apex:form with a commandButton; clicking on the button redirects to page B. All is working well for an authenticated user but for the Site Guest User the commandButton is not firing. Actually something is happening, and the page is getting refreshed but its not redirected to page B, and I don't see that the method is called when I check the debug log.

When I try to display page B by typing in its URL in the public site, everything is working fine.

Can someone save me, and suggest why the redirect is not happening for the Site Guest Profile?

Button Code:

<apex:commandButton value="{!$Label.SUBMIT}" action="{!doSubmit}" style="width:150px; margin-right: 45px; float:right" styleClass="btn-success" id="doSubmit"/>

Controller method:

public PageReference doSubmit(){        
        theCase.SuppliedName=theAcc.FirstName + ' ' + theAcc.LastName;
        insert theCase;

        theCase = [SELECT ID, CaseNumber, Type, SuppliedName, SuppliedPhone, SuppliedEmail, Subject, Description
                   FROM Case 
                   WHERE ID =: theCase.ID limit 1];

        PageReference pageRef = Page.WebFeedbackConfirm;
        return pageRef;              
    catch(Exception e){
        errorMsg = Label.Faild_to_submit_Feedback;
    return null;
  • 1
    Any clues in the Force.com debug log or JavaScript console? Can you post some code? – metadaddy Apr 27 '14 at 18:22
  • No clues. Which part of the code you suggest I post? – Dedo Apr 27 '14 at 18:23
  • Apex form with command button, and the action function. – metadaddy Apr 27 '14 at 18:24
  • As @metadaddy asked, unless you share your code it is very hard to give or suggest solution. – Bforce Apr 27 '14 at 18:26
  • It looks like you are also referring to some account fields, does the site user have access to read the account/contact object and those fields? These issues are usually related to field or page security settings missing for the profile. – PepeFloyd Apr 27 '14 at 20:20

Dedo, what does the button do besides change the page? Does it save anything, set parameters, etc?

I ask because 99% of sites issues are related to that profile not being able to do something (either permissions- wise or due to the licensing constraints).

Can you share the code that the button invokes?

| improve this answer | |
  • I was thinking the same so I made sure all the Case fields are editable by the Guest Profile – Dedo Apr 27 '14 at 19:32
  • Whatever is happening isn't showing up in your error message, right? Can you try adding system.debug(e.getmessage()) in your catch? In the debug logs, can you see that the query is returning 1 row as expected, or is the insert failing? Is a case being created at all? – Shane McLaughlin Apr 27 '14 at 20:29

So I finally found the reason: on the page I'm displaying a couple of Account fields. Even though I'm not updating the Account in my action method, the page is validating the user permissions (Site guest users have no update permission), and blocks me from invoking the the controller. I worked around this by assigning the Account fields to controller variables and binding the latter to the vf page.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.