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
krishnagkrishnag 

how to update a standard object record using sites

hi  i created a site where the guest users can edit their personal information. the operation should be on lead object.so i created a custom controller submitt which will save the edited info by user. it worked fine in the develoepr mode. when i put that page in sites its not updating the information on the lead record. when i went to public access settings and checked there are no modify permission for leads on sites. how can i achieve this task through sites. 

BulentBulent

sites only grants read and create on standard objects. You will need to authenticate your site visitors with a valid portal license in order to gain update/delete access on standard objects.

 

krishnagkrishnag

u mean we need to have a customer portal setup.but in my case the user is guestuser he is not contact 

BulentBulent

yes as a guest user (site user) you can only create or read standard objects. In order to gain update/delete access you need to authenticate users via portal (with the proper licenses).

krishnagkrishnag

so there is no option for a guest user to edit his info.,beacuse as you said the authentication can be done only thru portal licenses the user can be a portal user only if he is a contact atleast ,as a lead he has no autorization right?

BulentBulent

if you use custom objects rather than leads you can but lead is a standard object and site license doesn't provide update on leads.

krishnagkrishnag

hi i used a custom object to store the updated data instead of saving in standard object.even then iam not able to store the data in custom object using sites.

BulentBulent

this example might help:

Book: Force Platform Developer Guide Chapter 14 shows how to expose an application on Force.com Sites

AkiTAkiT

 


Bulent wrote:

if you use custom objects rather than leads you can but lead is a standard object and site license doesn't provide update on leads.


 

You can update leads writing a custom controller.  And campaign members as well. For example lead could this way post reply to event invitation.

 

 

Ken KoellnerKen Koellner

What I found is that a VF controller without sharing can update any record.  But if you put the record directly on the page and it has an "ID", the fields won't be writable.

 

So if you want to do an update, there's two work arounds--

 

  1. Use input tags on your page not associated with the existing object.  Then in your safe method in your controller, put the values in the sObject  you want to update.
  2. Cache the ID of the object(s) somewhere else, set it to null in the object, then during the save, replace the Id with the cached ID.

 

See this thread for details -- http://boards.developerforce.com/t5/Force-com-Sites-Site-com/Site-written-in-VF-and-access-to-standard-objects-with-Public/td-p/700949

VineetzVineetz
Thanks a lot Ken !
Andrew B. DavisAndrew B. Davis

Ken's link above is broken, but here's the updated link to the article: https://developer.salesforce.com/forums/?id=906F00000009B3YIAU