I have a visualforce page that has a user sign up for a newsletter. It inserts their information into a custom object "Individual" The page uses the Individual standard controller and a redirect controller extension to redirect them to a thank you page on "save"

The code works when I preview it but doesn't insert a record from the site. The page loads with all fields, all editable, and on "save" it redirects to the thank you page but no "Individual" record is created.

User has read, create, and edit access under "Public Access Settings", and all related fields visible under "Field-level security"

Redirect Controller Extension:

public without sharing class RedirectExtension {
    ApexPages.StandardController standardController;
    public String redirect {get; set;}

    public redirectExtension (ApexPages.StandardController stdController) {
        standardController= stdController;

    public PageReference SaveAndRedirect (){

        return new PageReference(redirect);


<apex:page StandardController="Individual__c"  extensions="RedirectExtension" standardStylesheets="false" showheader="false" sidebar="false">

<script src="/soap/ajax/34.0/connection.js" type="text/javascript"></script>
<script src="/soap/ajax/34.0/apex.js" type="text/javascript"></script>

<apex:includeScript value="{!$Resource.Jquery}"/>

<apex:stylesheet value="{!$Resource.EmilySalesforcecss}" />

<apex:form >
    <apex:inputHidden id="redirect-link" value="{!redirect}"/>

    <div id="background">
        <div id="container" class="ui-corner-all">
            <div id="header" data-role="header" align="center">
                <h1 Style="font-size: 25px;">
                    <div align="center">
                        <apex:image url="{!$Resource.UGL_Logo}" width="175" height="175"/>
                        Newsletter Sign-Up
                    Sign up to receive bimonthly LabNotes e-newsletter from Urban Green Lab. &nbsp;We'll keep you updated on our work and provide opportunities to get involved.
            <h2 Style="font-size: 15px;">
            <apex:pageBlock >

                <apex:pageBlockSection columns="1" id="individual-info"> 
                    <label class="required"><span class="assistiveText">*</span> = required field</label>
                    <apex:inputField value="{!Individual__c.Name}" required="true"/>
                    <apex:inputField value="{!Individual__c.Address__c}"/>
                    <apex:inputField value="{!Individual__c.Addr2__c}"/>
                    <apex:inputField value="{!Individual__c.City__c}"/>
                    <apex:inputField value="{!Individual__c.State__c}"/>
                    <apex:inputField value="{!Individual__c.Zip_Code__c}"/>
                    <apex:inputField value="{!Individual__c.Email__c}"/>

            <apex:pageBlock >
                <apex:pageBlockButtons id="editButtons" location="top" rendered="true">
                   <apex:commandButton id="saveBtn" value="Submit" action="{!SaveAndRedirect}" />

<script type="text/javascript">

    function InitPage(){

2 reasons for the error that I can think of (considering it is working properly on normal login)

  1. Site is not active
  2. Need to add the site VF page and related controllers as enabled VF pages / classes under public access settings profile


  • The site's "Active" checkbox is checked. Both Newsletter_Sign_Up and Newsletter_Thank_You are enabled under "Enabled Visualforce Page Access" and the RedirectExtension is enabled under Enabled Apex Class Access – E. Holden Dec 21 '15 at 18:24
  • Damn then I am out of reasons. I need org to look into in such scenarios. Otherwise it becomes too difficult to gauge the reason – Kaushik Ray Dec 21 '15 at 18:47
  • thanks anyway. I am also out of reasons. been trying different changes since yesterday and keep getting the same result. I added some debug logs and interestingly, the record does get an "id" assigned after update. When i added a manual insert (rather than standard controller's save) and added a system.debug(indiv.id); I get a debug log entry with an id (|USER_DEBUG|[21]|DEBUG|a011a000002YeaYAAS). But can't see a record – E. Holden Dec 21 '15 at 22:03
  • This is definitely related to permissions. If you think looking at org may be feasible option, then let me know, we can discuss over chat (as it sounds interesting) – Kaushik Ray Dec 22 '15 at 6:23

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.