+ Start a Discussion
Lou Manley 7Lou Manley 7 

Feedback on how to implement this scenario - updating the lead object

Hi all,

I'm using Enterprise edition and I'm looking for feedback on how best to implement this scenario using Leads and Opportunities.

At a high level, I'm looking for a way to my customer to update information and send attachments through a web form that will update a lead. 

Scenario

1. When a lead is received (using web-to-lead), I want to automatically send out an email with a link to a web form

2. They user will follow the link in the email and be taken to a web form (no login required). 

3. The user will enter data into fields on the web form and upload documents and submit the form. 

4. On submit, those fields will update the lead and attach the documents to the lead

I'm trying to avoid purchasing pre-setup form, so would prefer to build / set this up myself.

Our website is already hosted elsewhere, so ideally, if I could built the form functionality code myself and then give it to the web developer to embed in a webpage that would be great.

Any advice would be appreciated.

Thanks.
 
Neha AggrawalNeha Aggrawal
Hi Lou,

I think it can be done easily using REST API.
1. First point can be done using auto response rules.
2. In the web form sent to the user, have a hidden field which can be the lead record id of Salesforce.
3. Once the user enters the data and uploads the documents, the file can be attached to the lead using REST API.

I have explored this solution in the following post: https://initaura.com/uploading-attachment-through-rest-api-salesforce-simple-working-solution/
Please take a look and let me know if it helps.

Thanks and Regards, 
Neha Aggrawal
www.initaura.com - Everything Salesforce (https://www.initaura.com)
Lou Manley 7Lou Manley 7
Thanks for the speedy feedback Neha.

Could you explain a bit more about how I would post the updated field values back to the lead? (As opposed to uploading the document to the lead - your article was pretty detailed on that point). 

Thanks
Lou
Neha AggrawalNeha Aggrawal
Hi Lou,

To update the values, you can use the end point "/services/data/v36.0/sobjects/Lead/LeadId"
You can check this link: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm

Somthing like this should work:
$data = json_encode(array("Field API Name" => $Field_value));
$url = "$instance_url/services/data/v45.0/sobjects/Lead/$LeadId";
    $curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER,array("Authorization: OAuth $access_token","Content-type: application/json"));
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

Hope this helps.
Thanks and Regards, 
Neha Aggrawal
www.initaura.com - Everything Salesforce (http://www.initaura.com)