[SalesForce] Is it possible to get the record ID and details of a Lead inserted through web2lead form

Basically I need to create a web application that contains a web to lead form. Upon submission of the Lead, I need to get the record ID and details of that Lead in my web application, which is obviously external to Salesforce.com. Any thoughts how I can go about doing this? Thanks!

Best Answer

Config solutions

You could define a workflow rule?

  1. Firing condition would be on lead creation (when certain criteria are met like stuff defined here + any fields you decide to have in the form)
  2. Action would be an outbound message flying back to your website.
  3. If not an outbound message - maybe an email alert going to dedicated mailbox that's readable by your app.
  4. Scheduled report sent to an user whose email happens to be monitored by your website ;)

Coding solutions - SF as the actor

  1. REST callout to your site, defined as @future in the "after insert" trigger on Lead.
  2. Scheduled batch job running hourly? daily? sending Ids of recently created leads.

Coding solutions - your page as the actor

All above are asynchronous, you don't wait for the answer, you get the message / email some time later. Means you'd have to store "unmatched leads" somewhere.

If that's unacceptable - you could ditch the web2lead process and create your own integration (via SOAP or REST), there are high chances you'll find something for yourself at http://wiki.developerforce.com/page/Data_Integration. Basically the create() call would return to you with either the error or lead's Id...

Or just ask by sending a query ;) Or being notified via Streaming API ;) Plenty of options really.

Related Topic