function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Web2LeedWeb2Leed 

Web to Lead Form: Lead Record Type Issue

We have 2 web-to-lead forms on our new website.  Both forms use the exact same fields - we just want them to come in as different Lead Record Types.

 

In order to do this, i added the fields we need in your code generator and included the lead record type as a field.  When we developed the form, the Lead Record Type field is hidden to the user, so depending on the form they're on, it automatically sends the Lead Record Type we want into sales force.

 

The correct code for the record type is passing to salesforce.  However, every lead is coming in as the same record type: "Other."

 

I have some screenshots of what we're passing to SF as well as the code SF generated for the form in the first place.  But I figured I'd give the overview before we got into the details.

 

Any help here would be greatly appreciated.

 

Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
b-Forceb-Force

Garett,

 

Here is your updated Web-2-Lead form

 

 

<form action="https://www.salesforce.com/servlet/servlet.WebToLe​ad?encoding=UTF-8" method="POST" id="contact_form"> 
      <input type=hidden name="oid" value="00D30000000j2Dz" />
      <input type=hidden name="recordType" value="01230000000mEvg">
<input type=hidden name="recordType" value="01230000000mEvg">
 
     <!-- <input type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="xxx@xxx.com"> --> 
            <input type=hidden name="retURL" value="http://ieq.xxx.com/contact-us/?thank-you" /> 
      <div class="form_group"> 
        <label for="first_name">First Name*</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /> 
        <label for="last_name">Last Name*</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /> 
      </div> 
      <div class="form_group"> 
        <label for="company" class="label_right">Company*</label><br /><input id="company" maxlength="40" name="company" size="20" type="text" class="input_right" /> 
        <label for="title" class="label_right">Title</label><br /><input id="title" maxlength="40" name="title" size="20" type="text" class="input_right"/> 
      </div> 
      <div class="form_group"><label for="email">Email*</label><input id="email" maxlength="80" name="email" size="20" type="text" /></div> 
      <div class="form_group"><label for="phone" class="label_right">Phone*</label><input id="phone" maxlength="40" name="phone" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="street">Address 1</label><input id="street" maxlength="40" name="street" size="20" type="text" /></div> 
      <div class="form_group"><label for="street" class="label_right">Address 2</label><input id="00N30000005oaH8" maxlength="50" name="00N30000005oaH8" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="city">City*</label><input id="city" maxlength="40" name="city" size="20" type="text" /></div> 
      <div class="form_group"><label for="zip" class="label_right">Zip*</label><input  id="zip" maxlength="20" name="zip" size="20" type="text" class="input_right"/></div> 
        <div id="filters_drop"> 
        <select name="state" id="state"> 
            <option value="Select State/Province">Select State/Province</option> 
<option value="AL">Alabama</option> 
    <option id="CAN-YT" value="YT">Yukon (YT)</option>        </select> 
        <select name="country" id="country"> 
            <option value="Select Country">Select Country</option> 
<option value="USA" selected>USA</option> 
<option value="UK">UK</option> 
<option value="Albania">Albania</option> 
<option value="Algeria">Algeria</option> 
<option value="American Samoa">American Samoa</option> 

<option value="Zimbabwe">Zimbabwe</option>        </select> 
        </div> 
      <label for="description" class="contact_label">Description</label><label for="required" class="contact_required">* required fields</label><br /> <textarea name="description"></textarea> 
      <input id="00N30000005oaHS" name="00N30000005oaHS" style="background: none; height: auto !important; width: auto !important;" type="checkbox" value="1" class="check_input" checked="checked" /><label for="optin" class="optin">Yes, keep me informed of what's new.</label><br /> 
      <select id="recordType" name="recordType" style="display:none;"><option value="01230000000mEvg" selected>Web Lead</option></select> 
      <span class="error" id="error" style="display:none;">Fill in all required fields.</span><input type="submit" id="contact_submit" name="submit" class="contact_submit" value="Submit &raquo;"> 
  </form>

 

update your code as per instruction , and then try it

Hope this will help you

 

 

Thanks,

Bala

All Answers

Ispita_NavatarIspita_Navatar

Hi,

Ideally when you generate the web-to-lead web form , then  it generates HTMl wherein the record type Select box is generated.

So I am presuming that you must have made some changes in the HTML thus generated by the web-to-lead functionality to ensure that it rendered as a hidden field with the necessary value and id.

Is this what you have done?

If yes, then it might have so happened that you might have missed something in the process?

I would suggest you to investigate the following:-

1. Please chack that ID of the hideen field meant for "Record type" is correct

2. also acertain that you are setting a value for the hiden field and that value is appropriate , you have to mention the record id of the related record type in the value attribute of the hidden field.

 

In case the above are fine , then do please share further details of the issue encountered by you.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

 

 

Web2LeedWeb2Leed

Ispita - 

 

Thanks for the quick response.  We did the standard tests to make sure we had everything right and things do seem to check out.  We even ran a test to see what the value being passed to salesforce was in salesforce's url and it was correct.  I have a screen shot of this as well as the code provided to us by SF.  I can also show you the forms we are developing.  What is the best way to share this with you?

 

Garrett

Ispita_NavatarIspita_Navatar

If possible you can post the screen shots and code here .

Web2LeedWeb2Leed

ere is the code we got from SF when we added the Lead Record Type field to our form.  There are 4 types of leads for this company: Other Leads, Web Leads, Report Request Leads, and White Paper Leads.  In this particular form, we want it to be passed as a "Web Lead."

 

<label for="recordType">Lead Record Type</label><select  id="recordType"><option value="">--None--</option><option value="01230000000mEvq">Other Leads</option>

<option value="01230000000mEvh">Report Requests</option>

<option value="01230000000mEvg">Web Lead</option>

<option value="01230000000mEvl">White Paper Lead</option>

</select><br>

 

Here is the code that is in our form that hides this field from the user and selects the appropriate lead record type automatically:

 


 

<label for="description" class="contact_label">Description</label><label for="required" class="contact_required">* required fields</label><br /> <textarea></textarea>

      <input id="00N30000005oaHS" style="background: none; height: auto !important; width: auto !important;" value="1" class="check_input" checked="checked" /><label for="optin" class="optin">Yes, keep me informed of what's new at Aircuity and their successes.</label><br />

      <select id="recordType" style="display:none;"><option value="01230000000mEvg" selected>Web Lead</option></select>

      <span class="error" style="display:none;">Fill in all required fields.</span><input id="contact_submit" class="contact_submit" value="Submit &raquo;">

  </form>

 

When we send the information, we get the notification from https://salesforce.com/servlet.WebToLead?encoding=UTF-8 and the lead record type being passed is 01230000000mEvg, which is in fact the value for Web Lead.  Not sure what else to do here...

 

Thanks for your help.

 

b-Forceb-Force

Hi Garrett,

 

Please remove all the code that you add for your Record Type Logic in your form,

Just add a hidden field which will contain selected record type id

 

 

<label for="description" class="contact_label">Description</label><label for="required" class="contact_required">* required fields</label><br /> <textarea></textarea>

      <input id="00N30000005oaHS" style="background: none; height: auto !important; width: auto !important;" value="1" class="check_input" checked="checked" /><label for="optin" class="optin">Yes, keep me informed of what's new at Aircuity and their successes.</label><br />

      <select id="recordType" style="display:none;"><option value="01230000000mEvg" selected>Web Lead</option></select>
<input type=hidden name="recordType" value="01230000000mEvg">

<span class="error" style="display:none;">Fill in all required fields.</span><input id="contact_submit" class="contact_submit" value="Submit &raquo;"> </form>

 

try with this, It works  (.......If It doesnt work for you paste entire HTML of your Web-To-Lead form in next post)

 

Thanks,

Bala

 

Web2LeedWeb2Leed

Thanks Bala - 

 

We are still seeing "Other Lead" as the result.  I have copied the code below for the Web Lead form.  I took out alot of the states/countries to keep the length down.  Everything else is the same as it is on the site:

 

 

 
  
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" id="contact_form"> 
      <input type=hidden name="oid" value="00D30000000j2Dz" /> 
     <!-- <input type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="xxx@xxx.com"> --> 
            <input type=hidden name="retURL" value="http://ieq.xxx.com/contact-us/?thank-you" /> 
      <div class="form_group"> 
        <label for="first_name">First Name*</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /> 
        <label for="last_name">Last Name*</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /> 
      </div> 
      <div class="form_group"> 
        <label for="company" class="label_right">Company*</label><br /><input id="company" maxlength="40" name="company" size="20" type="text" class="input_right" /> 
        <label for="title" class="label_right">Title</label><br /><input id="title" maxlength="40" name="title" size="20" type="text" class="input_right"/> 
      </div> 
      <div class="form_group"><label for="email">Email*</label><input id="email" maxlength="80" name="email" size="20" type="text" /></div> 
      <div class="form_group"><label for="phone" class="label_right">Phone*</label><input id="phone" maxlength="40" name="phone" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="street">Address 1</label><input id="street" maxlength="40" name="street" size="20" type="text" /></div> 
      <div class="form_group"><label for="street" class="label_right">Address 2</label><input id="00N30000005oaH8" maxlength="50" name="00N30000005oaH8" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="city">City*</label><input id="city" maxlength="40" name="city" size="20" type="text" /></div> 
      <div class="form_group"><label for="zip" class="label_right">Zip*</label><input  id="zip" maxlength="20" name="zip" size="20" type="text" class="input_right"/></div> 
        <div id="filters_drop"> 
        <select name="state" id="state"> 
            <option value="Select State/Province">Select State/Province</option> 
	<option value="AL">Alabama</option> 
    <option id="CAN-YT" value="YT">Yukon (YT)</option>        </select> 
        <select name="country" id="country"> 
            <option value="Select Country">Select Country</option> 
	<option value="USA" selected>USA</option> 
	<option value="UK">UK</option> 
	<option value="Albania">Albania</option> 
	<option value="Algeria">Algeria</option> 
	<option value="American Samoa">American Samoa</option> 
 
	<option value="Zimbabwe">Zimbabwe</option>        </select> 
        </div> 
      <label for="description" class="contact_label">Description</label><label for="required" class="contact_required">* required fields</label><br /> <textarea name="description"></textarea> 
      <input id="00N30000005oaHS" name="00N30000005oaHS" style="background: none; height: auto !important; width: auto !important;" type="checkbox" value="1" class="check_input" checked="checked" /><label for="optin" class="optin">Yes, keep me informed of what's new.</label><br /> 
      <select id="recordType" name="recordType" style="display:none;"><option value="01230000000mEvg" selected>Web Lead</option></select> 
      <span class="error" id="error" style="display:none;">Fill in all required fields.</span><input type="submit" id="contact_submit" name="submit" class="contact_submit" value="Submit &raquo;"> 
  </form>

 Please let me know if you see anything we're doing wrong.

 

 

 

b-Forceb-Force

Garett,

 

Here is your updated Web-2-Lead form

 

 

<form action="https://www.salesforce.com/servlet/servlet.WebToLe​ad?encoding=UTF-8" method="POST" id="contact_form"> 
      <input type=hidden name="oid" value="00D30000000j2Dz" />
      <input type=hidden name="recordType" value="01230000000mEvg">
<input type=hidden name="recordType" value="01230000000mEvg">
 
     <!-- <input type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="xxx@xxx.com"> --> 
            <input type=hidden name="retURL" value="http://ieq.xxx.com/contact-us/?thank-you" /> 
      <div class="form_group"> 
        <label for="first_name">First Name*</label><input id="first_name" maxlength="40" name="first_name" size="20" type="text" /> 
        <label for="last_name">Last Name*</label><input id="last_name" maxlength="80" name="last_name" size="20" type="text" /> 
      </div> 
      <div class="form_group"> 
        <label for="company" class="label_right">Company*</label><br /><input id="company" maxlength="40" name="company" size="20" type="text" class="input_right" /> 
        <label for="title" class="label_right">Title</label><br /><input id="title" maxlength="40" name="title" size="20" type="text" class="input_right"/> 
      </div> 
      <div class="form_group"><label for="email">Email*</label><input id="email" maxlength="80" name="email" size="20" type="text" /></div> 
      <div class="form_group"><label for="phone" class="label_right">Phone*</label><input id="phone" maxlength="40" name="phone" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="street">Address 1</label><input id="street" maxlength="40" name="street" size="20" type="text" /></div> 
      <div class="form_group"><label for="street" class="label_right">Address 2</label><input id="00N30000005oaH8" maxlength="50" name="00N30000005oaH8" size="20" type="text" class="input_right"/></div> 
      <div class="form_group"><label for="city">City*</label><input id="city" maxlength="40" name="city" size="20" type="text" /></div> 
      <div class="form_group"><label for="zip" class="label_right">Zip*</label><input  id="zip" maxlength="20" name="zip" size="20" type="text" class="input_right"/></div> 
        <div id="filters_drop"> 
        <select name="state" id="state"> 
            <option value="Select State/Province">Select State/Province</option> 
<option value="AL">Alabama</option> 
    <option id="CAN-YT" value="YT">Yukon (YT)</option>        </select> 
        <select name="country" id="country"> 
            <option value="Select Country">Select Country</option> 
<option value="USA" selected>USA</option> 
<option value="UK">UK</option> 
<option value="Albania">Albania</option> 
<option value="Algeria">Algeria</option> 
<option value="American Samoa">American Samoa</option> 

<option value="Zimbabwe">Zimbabwe</option>        </select> 
        </div> 
      <label for="description" class="contact_label">Description</label><label for="required" class="contact_required">* required fields</label><br /> <textarea name="description"></textarea> 
      <input id="00N30000005oaHS" name="00N30000005oaHS" style="background: none; height: auto !important; width: auto !important;" type="checkbox" value="1" class="check_input" checked="checked" /><label for="optin" class="optin">Yes, keep me informed of what's new.</label><br /> 
      <select id="recordType" name="recordType" style="display:none;"><option value="01230000000mEvg" selected>Web Lead</option></select> 
      <span class="error" id="error" style="display:none;">Fill in all required fields.</span><input type="submit" id="contact_submit" name="submit" class="contact_submit" value="Submit &raquo;"> 
  </form>

 

update your code as per instruction , and then try it

Hope this will help you

 

 

Thanks,

Bala

This was selected as the best answer
b-Forceb-Force

if above solution didnt work for you,

 

go to WebtoLead setup

Check default owner of the lead,

GO to his profile and Check this record type is available for him

If recordtype is not available to this user , ENABLE It

and then try form

 

Hope this will be work

 

Thanks,

Bala 

 

b-Forceb-Force

Any solution work for you mark as accepted :)

 

Thanks,

Bala

 

 

Web2LeedWeb2Leed

All lead record types we set up are enabled for this profile...I just checked. fyi 

b-Forceb-Force

Did you try newlly updated WEB2LEAD code ?

 

If there is no any luck

mail me your WEB2Lead Page  and LIST of all record type Name and their SFID

 

Thanks,

Bala

 

 

 

b-Forceb-Force

Check out the lead with Email address recorcType@recordtype.com  (I have just submit the form with this email addres)

in your org, Llet me know its recordType

 

Thanks,

Bala 

Web2LeedWeb2Leed

Hi Bala,

 

That worked!  Thank you for your help.

 

However I am curious to know what changed so that the Lead Record Types come through now.  Could you please let me know?

b-Forceb-Force

Garett,

 

It really nice that finally it works. 

 

I just passed correct recordType value by using hidden field as follow

  <input type=hidden name="recordType" value="01230000000mEvg">

and that did all job for us ....:)

 

Please accept the solution which work for you and Help to community :)

 

one more thing I was get shocked due to your retUrl  :(

 

Thanks,

Bala

 

Thansk

 

Web2LeedWeb2Leed

I guess what I'm having trouble understanding is why that code didn't work when we had it in yesterday.  Was anything changed on the SalesForce side?  We have not changed our form code since trying that code and failing yesterday afternoon.  Yet it works this morning...

 

If i accept the solution, are we able to continue this discussion?  I'm just more curious than anything at this point.

b-Forceb-Force

Garett,

If you want to test the functionality, why its working

just remove following code from the form

 

<input type=hidden name="recordType" value="01230000000mEvg">

and see the result,

it will again rollback to your default record type

Thanks,

Bala

iluuukiluuuk

Hi Guys,

 

It's 2012 and I have the same issue here. Record Type is POSTed correctly by my form, but SF just writes the default value for RecordType. The user I use as owner for Web-To-Lead generated leads is the super admin and can choose record type when creating a new lead.

 

Have you managed to solve this??

 

Cheers,

 

Lucas

Marc Bourlon 21Marc Bourlon 21
Old thread, but while I posted one of the stumping reasons of this default RT being assigned, despite NOTHING asks for it (keep RT, default RT is ok, etc.) in another thread, I still lost over an hour today to find it. You must use the 15 chars ID of the recordtype, not the 18 chars version! So stupid...
Alex Kazlou 7Alex Kazlou 7
Marc, thank you so much! I thought I was going insane. All these answers assume that people simply didn't have their settings right. YOURS is the real solution for me. You saved me hours, if not days, of troubleshooting. And yes, unbelievably stupid on Salesforce part. Who would  ever suspect that an 18-digit ID would cause this? Salesforce suggest using case-safe IDs everywhere, except, aparently, the web-to-lead form. Thanks again for your answer!
Surya Kant SwamiSurya Kant Swami
Hi Marc, I tried what you wrote but still not working. Lead is going to default record type not to  the one I mentioned in form. 
Marc Bourlon 28Marc Bourlon 28
Hi Surya. Difficult to debug without any visibility on your code. Web-to-lead does work, so if you are sure your ID is correct, check the other possible stumbling blocks. Cheers.