Loading

Add additional fields to the Standard Web-to-Lead form

Publiceringsdatum: Sep 22, 2026
Beskrivning

Additional fields can be added to the standard Web-to-Lead form in Salesforce with the following modifications.

Lösning

Salesforce can automatically create Leads based on information captured directly on your website. This article explains how to create a new Lead custom field, generate updated Web-to-Lead HTML that includes it, and add that HTML to your website.

Step 1: Create a New Lead Custom Field to Capture the New Information

  1. Navigate to:
    • In Salesforce Classic: Your Name | Setup | App Setup | Customize | Lead | Fields.
    • In Lightning Experience: Gear icon | Setup | Object Manager | Lead | Fields and Relationships.
  2. Scroll down and click the New button next to Lead Custom Fields.
  3. Enter the Data type for the field and the appropriate label for the field.
  4. Click Save.
  5. Optionally, map this lead field to Accounts, Contacts, and Opportunities if the lead is converted. To update the mapping, click the link Map Lead Fields located next to 'New'. This will ensure that the information is retained when the lead is subsequently converted.

Step 2: Generate the Sample HTML Code for This New Field

  1. Navigate to:
    • In Salesforce Classic: Your Name | Setup | App Setup | Customize | Leads | Web-to-Lead.
    • In Lightning Experience: Gear icon | Setup | Feature Settings | Marketing | Web-to-Lead.
  2. Click Create Web-to-Lead Form.
  3. Select only the Lead field you just created from 'Available Fields' to 'Selected Fields'.
  4. In 'Return URL', add a link to redirect the visitor to after the Web-to-Lead form submission. The "Return URL" value is what the user gets redirected to after submitting the form — for example, if you set Return URL to www.salesforce.com, after the user submits the form, they'll be redirected to www.salesforce.com.
  5. Click Generate.
  6. Select all the text in the text box and copy and paste it into Notepad or a similar text editor.
  7. On the Menu Bar, click File.
  8. Click Save As.
  9. Save it as an HTML file by adding ".html" after the name of the file (for example, webtolead.html).
  10. On the 'Save as type' dropdown, select All Files.
  11. Right-click the file, choose Open With, and select your desired browser (e.g. Chrome).

Note: This method allows you to verify the new field is included on the form, and confirm that submitting the form creates Leads in the organization based on the information entered.

Step 3: Incorporate the New HTML into Your Website

  1. Paste the HTML you copied into an email and send it to your webmaster.
  2. Your webmaster will need to add the input elements in this sample HTML into your website. They will also likely want to customize the look and feel to match that of your website.
Knowledge-artikelnummer

000385435

 
Laddar
Salesforce Help | Article