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

Update contact field on page - access denied

Hi Folks,


I have assigned 4 custom boolean fields to the Contacts and these are for users to update which email they would like to subscribe too, such as Monthly Newsletter, New Courses etc.


I am trying to create a page on our site that displays the 4 checkboxes with a save button, so we can attach a link to the bottom of the emails we send for users to update their subscriptions to the emails we send them.


Visualforce Page:


<apex:page Controller="EmailSubscriptionController">
    <apex:form >
        <apex:messages />
        <br />

        <apex:inputCheckbox id="Brochure_email__c" value="{!contact.Brochure_email__c}"/>Brochure Email<br />
        <apex:commandButton value="Save" action="{!save}"/>



Apex Class:


public class EmailSubscriptionController {

    public final Contact contact;
    public ID get_id {get;set;}
    public boolean email_brochure {get;set;}

    public EmailSubscriptionController() {
        contact = [SELECT Brochure_email__c  FROM Contact
            WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

    public Contact getContact() {
        return contact;

    public PageReference save() {

        try {
        } catch(System.DMLException e) {
            return null;

        return null;



The code shows me the page fine, and check's the relevant boxes, but when i click update it gives me the following error message: Update access denied for Contact


Any ideas on how i can get this working?


Many Thanks





Laxman RaoLaxman Rao

might be two reasons


1 Object level permissions are missing(like edit, create)

2 Missing Field level security for contact fields.(go to public access setting and give fls permissions)



I am trying to do something similar and see the same behavior.


Additionally, even though my "save" method is not yet executing any DML, I am seeing the same error, which I find very strange.


Can you try commenting out the body of your save() method (maybe just put in a debug line) and see if you still get this exception?



On site Page I'm getting:
" Update access denied for Contact, controller action methods may not execute" exception.
However on internal page records are getting updated properly. Please suggest.
Lincoln KaruhangaLincoln Karuhanga