+ Start a Discussion
Sumit  61Sumit 61 

I have create a button on lead object for sending mail to the given mail id. on mail i'm sending a Vf form, Now i want when the user click on that link he will able to update fields on lead.

Srinivas SSrinivas S
please expose the visualforce page with sites by giving proper permissions on the lead object.
Please follow the blow link as reference -
http://salesforce.stackexchange.com/questions/17419/adding-visualforce-page-to-sites

Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Sumit  61Sumit 61
Thanks For Reply Srinivasa.
i have already used Force.com Sites. I have created a visual page and linked with Sites force.com link. by the help of link i am only able to create a new Lead, but i want to update the other field on the same lead?

 
Srinivas SSrinivas S
While providing the link while sending the email please include a parameter. If the guest user hits your page with a parameter to identify your lead and if the user click on save, please do an upser operation.
Note: parameter can be lead id or an external field maintained in your lead object, it will be useful while upserting the record.

Thanks,
Srinivas
- Please mark as solution if your problem is resolved.
Sumit  61Sumit 61
thanks Srinivasa Reddy S , can you please give any example code for that i had tried a lost but got unsuccessful.
I am trying on this since last 3 days
ManojSankaranManojSankaran
Hi Sumit,

Updating the lead direclty from the VF Page published in the Sites is not possible. Because when you share a link to the end user, he will be performing all the operation as guest user (User License). For which he will have only read and create permission for standard objects. But for custom object guest user will have full access.

Below is the work around
1. Send the Link with Lead Id to the End User.
Example : 
http://aig-site-testing-developer-edition.ap1.force.com/updateLead?id=00Q9000000LzVf6

2. Create a Custom Object say SitesLead and Create the fields that you want to update in lead.Lets consider you want to update the lead address. Create those fields in our SitesLead Object.

3. In our Sites Visualforce page get the id of lead from the URL and display the values of the lead address there. When end user saves the record create a record in the SitesLead (Dummy Object). Also copy the lead Id in the dummy object when creating the record.

4. Write a simple trigger in SitesLead Object and update the lead record based on the id saved in the "SitesLead" (Our Custom Object)

5. You can also write a batch class which will delete all the "SitesLead" Records frequently.


If you need any clarification let me know.

Thanks
Manoj S