Debugging web to lead forms using salesforce proactively and easily.

Imagine that you are a salesforce admin or developer  and your website lead form is integrated with salesforce.  All of a sudden, the leads are no longer coming in. You think how on earth am I going to do fix  this?  The only thing which shows up is the form getting submitted and redirected to the page which you want but when you log back in salesforce, there is no lead created at all.

So what are the best ways to debug web to lead forms and fix issues? This post would help developers and salesforce admins to identify the issues quickly and prevent major problems later.

  1. View the error in debug log right away

As soon as  you see an issue with the web to lead form, the first thing you want to do is enable the debug log and see if there is any error.  Here are steps which you can do to make this happen.

a.  Before you enable debug log, you need to make yourself the lead owner. You have to do this to see the debug log otherwise you will not be able to see any debug logs at all.

LeadOwnerIssue

b. Go to setup–> logs-> Enable debug logs.

 

EnableDebugLogs

c. You should look for the web to lead logs and see if there is any errors which show up.  Based on the error, you need to act on it right away.

2.  Watch out for null pointers exceptions  on the lead insert triggers.

Now you would see errors like Null pointer exceptions on the error log.  Here are things which you can do to fix them.

a. If you have any custom fields on the lead with a default values assigned to the fields,  the default values will not be populated on web to lead forms. The default values on leads would only be populated if the lead is manually created inside the salesforce org and will never work when called using an api. Web to lead forms use the api  and so thi swill not work. Your lead insert triggers might be expecting a value on the field which will fail now with a null pointer exception.  So make sure you put a default value on the triggers to gix this issue once for all.

b. Some times, you might have created required fields on the leads without testing the web to lead forms. Now these required fields or validation rules do work inside the salesforce org but on the web to lead forms, they would throw errors which need to be fixed right away.

3. Proactively  handling web to lead form errors.

Since web to lead forms are such a black box where there is not an easy way to fix the issues, one of the thing I would recommend is using a custom object for exception handling. The below are the details to make it work.

a. Create a custom object called Exception with fields like stack trace( which would have the exception stack trace),apex class ( apex class name),  source of error( web to lead form, integration, apex batch are possible values).

b. On your lead insert triggers, make sure you have a try catch exception handler and on the catch , insert the exception on the custom object.

c. Also have an email alert notify the admin or the developer team as soon as the exception happens on the web to lead form. This would help developers or admins to view the exception right away on the custom object and fix it rather than waiting for the business team to notify them. Imagine how much of this would be a time saver when you have a big campaign going on and all your web to lead forms fail!!!

So using the above techniques, you can easily fix web to lead issues and prevent problems. Here are the key takeaways from this blog.

a. Use the lead owner to your name temporarily to view the debug log to fix the error.

b. watch out for required fields, default fields and validation rules on leads newly created to identify the source of the problem.

c. Proactively create a custom object to log exceptions and have an automatic email alert to notify on web to lead failures.

I hope this blog has been of use to you and this should help to fix web to lead issues. Please feel free to email me at buyan@eigenx.com for any further questions.

Please subscribe

Subscribe to our mailing list and get tips to maximize salesforce to your email inbox.

I am honored to have your subscription. Stay tuned for tips to maximize your salesforce investment

Something went wrong.

Share:
buyan47

Author: buyan47

Hi there! My name is Buyan Thyagarajan. I am a Salesforce consultant specializing in Higher Education, Manufacturing and Marketing Automation. My blogs will help you to maximize your Salesforce CRM investments, prevent problems beforehand and make the right decisions. If you need to talk to me right away, you can email me at buyan47@gmail.com or call me at 302-438-4097

2 thoughts on “Debugging web to lead forms using salesforce proactively and easily.

    1. Hi Bishwambhar,
      Great to hear on my blog which helped you to debug your web to lead. Please feel free to add any other info you found helpful while debugging web to lead forms as well?
      Buyan

Leave a Reply to buyan47 Cancel reply

Your email address will not be published. Required fields are marked *