How to test Salesforce Web-to-Lead in Sandbox
Posted on November 11, 2011 by Sean
First, create your Web-to-Lead form. To create your form, go to Setup -> Customize -> Leads -> Web-to-Lead and click the ‘Create Web-to-Lead Form’. Select your fields, enter your Return URL, and click ‘Generate’.

Select and copy all the generated HTML code and paste into a new text document.
Next, edit the form action in the new document to point to your Sandbox. The form action is the line of code below:
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
You’ll need to remove ‘www’ and replace with the subdomain from your Sandbox URL. For example, if my Sandbox URL is “https://na1.salesforce.com...”, my form action will be:
<form action="https://na1.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
All I did above was change ‘www’ to ‘na1’.
Then, locate the line of code similar to below:
<input type=hidden name="oid" value="00Dxxxxxxxxxxxx">
This line is your Organization ID. The value must equal your Sandbox ID for Sandbox testing to work properly. To find your Organization ID, go to Setup ->Admin Setup -> Company Profile -> Company Information and then find the field ‘Salesforce.com Organization ID’.
Finally, save your document to your desktop as an HTML file. Open it. You should see a simple web form with the fields you selected in the first step. My example is below (your fields will likely be different):

Fill in your form as necessary and click ‘Submit’. Log into your Sandbox account, find your lead, and check your fields for accuracy.
Insightful Commentary
Currently, there are no comments on this post. Start the discussion below!


