I have a VisualPage form that posts to


After the post my browser correctly gets redirected to the post value specified in retURL, but the lead is not added to the database.

What is the best way to debug this problem?

Also, if someone has a list of the required post fields that the servlet expects as mandatory. Are the key names case sensitive?


1 Answer 1


I'm not sure if the key names are case-sensitive (I expect they are), but the identifiers for custom fields change from org to org. If you have Lead.My_field__c in a sandbox, it will have a different id in production. The only fields that are mandatory are:

  1. Lead.LastName
  2. Lead.Status (update: this may be set automatically by SF)
  3. Any custom field you mark as required in the definition
  4. An HTML hidden input for oid, which is your org's id

In addition, there are form fields you can add that put your form into debug mode. The following was taken from UI's Web2Lead generation tool:

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="[email protected]">                                           -->
<!--  ----------------------------------------------------------------------  -->

Enabling debug mode will do the following:

  1. Not submit the Lead to your org
  2. Display all form elements in your browser

In my experience, however, we receive an email whenever Salesforce cannot generate the Lead from the form's data. If you do not receive these emails you might be sending the form to the wrong org or have something mis-configured.

  • +1 for this good answer! I sure hope there is more that can be done, because all I got from debug mode was: Reason: Your Lead could not be processed.
    – JannieT
    Commented Dec 5, 2012 at 14:51
  • I presume oid would also be a required field, right? If I'm posting to a custom object, anything that specifies the object?
    – JannieT
    Commented Dec 5, 2012 at 14:54
  • Yes, but oid is not a Lead field - it is your org's id. I will update my answer.
    – Mike Chale
    Commented Dec 5, 2012 at 14:59
  • I hand-coded the form using a similar form (that posts successfully) as a starting point. Is there a way to look up what 00N70000001ngMx-like key to use for each object field? I am trying to guess which one is the Lead.Status
    – JannieT
    Commented Dec 5, 2012 at 15:58
  • 1
    @JannieT the 00N... thing is the custom field's Id (like all account Ids begin with 001 and if you type it in the browser you end up on Accounts Tab). So go to Setup, Lead fields and examine the links :)
    – eyescream
    Commented Dec 5, 2012 at 17:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .