You need to sign in to do that
Don't have an account?

Populating Lookup field on LEADS object using Web To Lead or Web Form.
Hi there,
We have a lookup field on LEADS point to Accounts. The Web To Lead Form does not display the Lookup field called "Reseller", and I am not sure what HTML element should be used to grab the data from the Web Form and then populate into the look up field into LEADS object.
We have tried using something like this:-
Reseller:
Reseller:<input id="00N80000004nbGG" maxlength="100" name="00N80000004nbGG" size="20" type="text" /><br>
This is not working.
On the Web Form the field Reseller is a picklist while in SFDC we are trying to populate into lookup field.
How should this be resolve, what do we need to do on our web form to populate this value into SFDC under the lookup field.?
In case you are still looking for a solution (and have the ability to write triggers), try the following:
1) Create a new Text field on the Lead object. Call it "Reseller Text" (or whatever you'd like). Write down the id of this field.
2) On your form update the input attributes as follows:
id:
this can be any value you want ('reseller-text' below). Salesforce does not care what value you put here (and, if you want your form to be W3C compliant, you dont want to start an id with a number).
name:
enter the id of the "Reseller Text" field you just created. ('00N400000012abc' below).
value:
this is the value you want to populate in the "Reseller" lookup field. ('00N800000045def' below).
3) Create a trigger to copy the value of the "Reseller Text" field to the "Reseller" lookup field. Your trigger may look something like this:
Note that this does not give your form the ability to perform a "lookup"- it just allows you to populate the Salesforce lookup field with a hard-coded value.
You could very easily change the <input> to a <select> field to populate the lookup field with any number of hard-coded values.
Good luck!
"Salesforce could not create this lead because of the reason listed below. For more information about this error or help with Web-to-Case-Lead, please contact Customer Support.
Reason: Apex trigger updatex1st_Dog_s_Breed caused an unexpected exception, contact your administrator: updatex1st_Dog_s_Breed: execution of BeforeInsert
caused by: System.StringException: Invalid id: Xoloitzcuintli: Trigger.updatex1st_Dog_s_Breed: line 9, column 1
Lead Capture Page: http://mywebsite.com/referral-3
Record Information:
00N1500000E7GOx = Quixote
00N1500000E7mKi = Xoloitzcuintli
city = Test City
email = ntruax@saferetrieve.com
encoding = UTF-8
encoding = UTF-8
first_name = John
last_name = Sample
lead_source = direct mail
oid = 00D15000000FylG
retURL = https://mywebsite.com/thank-you
state = Ca
street = 555 Address Lane
submit = Submit
zip = 55318
To incorporate this lead into salesforce.com you can key in the data above.
If you have any questions, please click on Support at the top right of any page within salesforce.com.
Customer Support
salesforce.com"
I am trying to use a web-to-lead form to capture a fixed set of values from a picklist, except I really want that to populate a custom object that I have linked to my lead records via a custom look-up field. Here is the code I tried to use:
trigger updatex1st_Dog_s_Breed on Lead (before insert) {
for(Lead newLead:Trigger.new){
if (newLead.Dog_Breed__c!=null) {
String x1st_dog_s_breedString = newLead.Dog_Breed__c;
Id x1st_dog_s_breedID = dog_breedString;
newLead.Dog_Breed__c = x1st_dog_s_breedID;
}
}
}
Can you tell me where I went wrong?
https://retrology.net/how-to-use-lookup-field-in-web-to-lead-form-in-salesforce/
https://retrology.net/how-to-use-lookup-field-in-web-to-lead-form-in-salesforce/