0

How to attach one of more files when creating web-to-lead from the code. Solution should not be any of the following:

  1. Visualforce pages in Force.com Sites
  2. Using Force.com web services API implementation.

1 Answers1

1

You can't. Consider cross-posting this to https://salesforce.stackexchange.com/, maybe somebody has a brillant idea.

There's idea you can upvote, looks like they'll have something in Summer'22. Until then you need VF page exposed as Site, Aura component exposed with Lightning Out or a proper API integration. Can you make-do with "InboundEmailHandler"? Body of email could be JSON or something, attachments you could save? 36 MB limit though.

Web-to-Case and Web-to-Lead support only simple forms. Normal HTTP way to mix forms and binary data is to use "multipart/form-data" but Web-to-Case doesn't support it: https://help.salesforce.com/articleView?id=sf.customizesupport_web_to_case_notes.htm&type=5

There are tricks like upload the file somewhere else (another website you control) and just display link to it on the Lead... But it's not true file upload to SF.

eyescream
  • 18,088
  • 2
  • 34
  • 46