0

I'm using a Web2Lead form, and on submit pass all input values. But when I try to insert latitude and longitude values, they are not inserted in SF record. I'm try to use different ways, but still no result. Debug log shows, that they are populated, but in SF I don't see them.

My Code Is

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<form action="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

 <input type=hidden name="oid" value="MYORGID">
 <input type=hidden name="retURL" value="http://">

 <input type="hidden" name="debug" value=1>                              
 <input type="hidden" name="debugEmail" value="MYEMAIL">                                   

 <label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
 <label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
 Latitude:<input  id="0BC1t000000c8iV" name="0BC1t000000c8iV" size="20" type="text" /><br>
 Longitude:<input  id="0BC1t000000c8iW" name="0BC1t000000c8iW" size="20" type="text" /><br>
 <input type="submit" name="submit">

</form>
  • please use edit and show the W2L HTML code used to pass lat/long – cropredy Oct 24 '19 at 1:16
  • @cropredy, added – Viktor Oct 24 '19 at 8:44
0

I don't think this is possible for OOTB geocodes

  1. Latitude and Longitude are geocode fields and meant to be derived using a service such as Data.com (from the Lead.Street, City, PostalCode, etc. fields)
  2. The Web-to-lead HTML generation doesn't enable these fields to be generated
  3. OOTB fields on W2L are referenced in the HTML by the API Name, not an Id yet when I try <label for="latitude">Latitude</label><input id="latitude" maxlength="40" name="latitude" size="20" type="number" /><br> the Latitude field is not populated in the resulting Lead

But for custom geocode fields, I created a field of type GeoCode Custom_Geocode__c with 6 decimal precision (I did not use hours/minutes/seconds)

Then I went to the W2L HTML generation page /lead/leadcapture.jsp and

  • created HTML,
  • saved into a file and then
  • opened the file in the browser
  • filled in the values (I used 56.7845 and 28.78661)
  • clicked Submit

Result, custom geocode fields were displayed in the page layout.

Here's the HTML from W2L

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

<input type=hidden name="oid" value="00DXXXXXXXXXXXX">
<input type=hidden name="retURL" value="http://www.foo.com">

<!--  ----------------------------------------------------------------------  -->
<!--  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="fred.fubar@foo.com">                                         -->
<!--  ----------------------------------------------------------------------  -->

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>

<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>

Custom Geocode (Latitude):<input  id="0BC630000008YMf" name="0BC630000008YMf" size="20" type="text" /><br>

Custom Geocode (Longitude):<input  id="0BC630000008YMg" name="0BC630000008YMg" size="20" type="text" /><br>

<input type="submit" name="submit">

</form>

Important - the Ids of these custom fields MAY/WILL NOT be the same when you deploy the fields to your Production or Staging org. You need to recreate the W2L form (or edit it) using the field ids of the custom fields per org

The custom geocode fields to be visible to the running user (via Profile or permission set) that executes the W2L process. See Web-to-Lead | Default Lead Creator

  • Hi! I'm using custom geocode field. This fields are populated from other code inside salesforce. But from W2L they are not fills. Maybe i'm missing some right way to set them in my form? I mean, instead of id="0BC1t000000c8iV" need to set id="Geocode__0BC1t000000c8iV__s"? – Viktor Oct 28 '19 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.