Salesforce Web-to-Lead: Set Record Type

Use case:

CompanyA has 3 separate web forms from 3 separate web pages. All of the lead records should be captured into the same Salesforce instance. In order to differentiate them, multiple record types are created in Salesforce.

Website Record Type
https://website1.com/contactus Contact Us
https://website1.com/signup Registration
https://website1.com/buynow Direct Purchase

 

Solution:

  • Generate 3x Web-to-Lead form from Salesforce. Each form will capture different fields
  • Get Record Type ID from each Record Type in Salesforce
  • Manually edit the Web-to-Lead form and add an additional hidden field that looks like this:
    ....
    
    ....