Editing Records of Standard Objects from Salesforce site

E

Salesforce Sites or Force.com Sites lets you create web sites that run natively on Force.com. It allows external users to access and modify records from Salesforce without the need of authentication or license.

But it does not allow Edit access to most of the standard objects. If there is a need to allow editing records of standard objects, one cannot directly edit them using fields directly on the Visualforce page (except for Orders and Contracts).

There is a simple yet effective work around for that which works just fine.

Instead of using fields reference on the Visualforce page, create variables in the controller and use them to get the input from the Visualforce page. Once the value is in those variables, assign them to the respective fields of the standard object in the controller.

Below is the part of the code that explains how this works.

<apex:inputtext value="{!value1}" label="Field1" />
<apex:inputtext value="{!value2}" label="Field2"/>
public String value1{get;set;}
public String value2{get;set;}
public pageReference updates(){

    case_record.Field1__c=value1;
    case_record.Field2__c=value2;
    update case_record; 
}

About the author

Afroz Kazi
By Afroz Kazi

Category