3

I'm looking for help. I'm new to Salesforce, learning to become an Admin.

We are developing a Web to Lead form. We'd like to automatically change anyone who submits the WTL form directly to a Contact after submitting.

If there's a short delay, 15 minutes, etc. than that is fine.

From what I can tell, a Workflow won't cut it as you can't make a workflow in one object, affect another object.

I know next to nothing about APEX triggers, but have developers who can look into it.

Has anyone attempted this or something similar?

Many thanks!

  • 2
    do you want the lead to automatically convert to account+contact+optional opportunity? or do you just want a contact created while retaining the Lead to go through the Lead's lifecycle? Normally, Leads don't become Contacts until the Lead is 'qualified' - otherwise you end up with lots of spam Contacts – cropredy Jul 22 '14 at 17:42
  • We're looking to use the WTL form simply as an inquiry form. Ideally, we'd just have a form feed directly into the Contact object. – Mike Mierendorf Jul 22 '14 at 18:08
4

You might be interested in sfdc-web2anything, which can directly create contacts. If that's not your thing, a trigger on lead could definitely convert leads on creation, if you'd like. Take a look at the LeadConvert object and the Database.convertLead function call.

Here's a simple trigger that reaches this objective:

trigger web2LeadConvert on Lead (after insert) {
    Database.LeadConvert[] converts = new Database.LeadConvert[0];
    for(Lead record: Trigger.new) {
        if(record.LeadSource == 'Web') {
            Database.LeadConvert thisLead = new Database.LeadConvert();
            thisLead.setLeadId(record.Id);
            thisLead.setConvertedStatus('Qualified');
            converts.add(thisLead);
        }
    }
    Database.convertLead(converts);
}
  • thank you! i'll pass this to our developers and look into it myself. – Mike Mierendorf Jul 22 '14 at 19:35
  • @MikeMierendorf Sure thing. I added a code sample that illustrates how I would perform such a task. – sfdcfox Jul 22 '14 at 19:43
0

If you want a form, with fields that the users have to fill out, then you will need to build a visual force page and a controller to go with it. This is the route I would go with. Its a lot less hard then it seems once you get the ball rolling with it.

https://developer.salesforce.com/page/An_Introduction_to_Visualforce

If you want a quick, press this and turn it into a contact, then you could write a solution using a custom button the form to "flag" a lead and then have a trigger update that record, or some other solution equally as hackish, but this kind of a solution would not allow you to have the user have any form of input before it is created.

Those seem like the best two solutions to me, but you may end up with your own.

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.