+ Start a Discussion
donsu04donsu04 

Referral Web-to-Lead form

I need to create a form for a refer-a-friend email campaign which captures 6 names and email addresses and converts them to leads. The six new leads also need to be linked to the person who referred them. My concern is how can I use one web to form to capture multiple leads.

 

Any help will be really really appreciated

 

Thanks

Jedd

Best Answer chosen by Admin (Salesforce Developers) 
SurekaSureka

Hi,

 

1. Have an hidden field in the html and populate that field with a default value

    For eg. In the following code, I have put "City" as the default hidden field and have populated value.

2. Use that hidden field in the trigger code and create leads appropriately.

    for eg. In the following code, I am checking if the last name field is not null, I am inserting a new lead. similarly, you     

    can check for all the six fields and insert records

 

trigger leadCheck on Lead (before insert)
{
    List<Lead> leads = new List<Lead>();
    
    for(Lead l:Trigger.new)
    {
        if(l.city!=null)
        {
            if(l.lastName!=null)
            {
                Lead l1 = new Lead();
                l1.lastName = l.lastName;
                leads.add(l1);
            }
        }    
    }
    insert leads;
}

 

Thanks