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
Alisa ZhurovaAlisa Zhurova 

How add custom lookup field on web-to-lead form?

Hello, I need to create web-to-lead form, in which instead of a product interest, there should be a product(lookup). How correctly to do this ?
 
I to create in Lead object custom field Product (Lookup) , but in web-to lead in Advanced fields this not watched(
User-added imageUser-added image
VinayVinay (Salesforce Developers) 
Hi Alisa,

Currently to add lookup fileds on web to lead feature is unavailable.  Kindly review below Idea link and vote for this featue.

https://trailblazer.salesforce.com/ideaView?id=08730000000BrJa

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Alisa ZhurovaAlisa Zhurova
I created text Field ProductName , also I created lookup field Product in object Lead
I edit my web-to-lead form and add in my code:
<div class="product">
        <label for="email">Product</label>
        <input  id="00N5g00000ImMOS" maxlength="24" name="00N5g00000ImMOS" size="20" type="text" value="00N5g00000ImLEm"/>
</div>
Also I to create trigger:
trigger UpdaterProduct on Lead (before insert) {
 for(Lead newLead:Trigger.new){        
        if (newLead.ProductName__c!=null) {             
            String ProductString = newLead.ProductName__c;            
            Id ProductID = ProductString;            
            newLead.Product__c = ProductID;       
        }      
    }    
}


how use this trigger in web-to-lead form?
Talha SaqibTalha Saqib
This guide can help you to use custom lookup field in the web-to-lead form:
https://retrology.net/how-to-use-lookup-field-in-web-to-lead-form-in-salesforce/