Uploading attachment for web to lead: Part III

I came across this approach when the REST approach did not work for one of my clients.

When a lead submits a form, all form builders provide the functionality to send email notification along with data submitted by lead. This email can also contain files uploaded by the lead.

For my client, we created an email service that would process this email and convert it to a lead. The files in the email can also be attached to the lead.

So we added the Salesforce email service in the form builder, and whenever a lead submitted the form, the notification would go to this email service. The email service apex class would then process the email to create the lead along with the files uploaded by the lead.

While this is not a point and click approach, it definitely needs some coding, there are few advantages to this approach:

  1. While many Salesforce developers might not know the REST API approach or even uploading the file to web server, most Salesforce developers know how to code for the email service class. It is actually quite basic.
  2. Your logic remains in Salesforce and is not distributed at multiple places.
  3. Your files are stored in Salesforce.

What’s more, my client asked me to make the class as flexible as possible. So he could add new forms or fields to existing web forms without modifying the class. And the same is easily feasible through the use of custom settings of a list type.

Do try this approach and let me know your thoughts. I really liked the simplicity of this approach.

Leave a Reply

Your email address will not be published.

Scroll to top