How to attach one of more files when creating web-to-lead from the code. Solution should not be any of the following:
- Visualforce pages in Force.com Sites
- Using Force.com web services API implementation.
How to attach one of more files when creating web-to-lead from the code. Solution should not be any of the following:
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.