Friday, April 19, 2013

The case of missing Leads information


These days I have been studying my Sales Cloud certification exam so I have dropped Apex and Visualforce for a little bit.  This morning it dawned on me I shouldn't only cover Force.com platform related topics in my blog.  So I'm also going to start putting in some tips and tricks of other parts of Salesforce from now on.

I recently joined the new SFDC Calgary User Group.  I hope by talking to other users of Salesforce, that would give me more topics to cover in my blog.

In our first User Group meeting I was talking to a few other Salesforce users.  Today I thought I would share with you the problems that one of the Salesforce users was encountering.

Say, you have been using Leads for a long time but every time when you convert the Leads, you lose all the information you have saved with the Leads.

This is clearly a case when you have used some custom fields for Leads but have not provided a mechanism to retain the field information when you convert leads.  Salesforce allows you to copy the Leads information into one or more of Account, Contact or Opportunity objects when you convert leads.  Here is how.

Say you have two custom fields, one called Custom Number and one called Custom Text.  Note the fields at the bottom of the page layout here.



After you save and then convert the lead, the information captured is no longer available.  This is because you have not instructed Salesforce where the two pieces of information should go after you convert the lead.  To fix this, it is a two-step process.


  1. You need to decide whether the information should reside in Account, Contact or Opportunity object.  You then go to create new custom fields in these objects.  Make sure you use the same data type, as you cannot copy a field that is of text type of a field that is of numeric type.  Note that some of your custom fields can go to Account, some to Contact and some to Opportunity object.  It is not an all-or-nothing scenario.  The only restriction is that you can only indicate one object for each field you want to map, i.e. you cannot map a Lead field to Account AND Contact at the same time (you can use trigger to circumvent that, but this is out of scope of this blog post because it is not something you can do simply using the Salesforce set-up menu.  Please contact me if you need more information on how to use trigger if you want to map a field from Lead to more than one object.)
  2. After performing step (1), all that is left to do is to set up the mapping.  Go to Setup -> Customize -> Leads -> Fields and scroll to the Lead Custom Fields & Relationships related list.  You will see a button labelled "Map Lead Fields".

In my example, I have created a custom field in Account called "Custom Number (from Lead)" that is of numeric type.  When I click the "Map Lead Fields" button I am brought forward to this screen.  See how the field from Account is populated for the corresponding field from the Lead object:


Once you have set it up, whenever you convert a lead, the information will be propagated automatically to one or more of Account, Contact and Opportunity based on what you have specified in step (2) above.  Try it out!

That still leaves a second problem.  What about the Leads that you have already converted?  Fear not.  Even though you will no longer see converted leads information from Leads, you can run reports to find them.

The easiest way is to go to Reports tab, create a new report using Leads as the report type.  On the left hand side of the report builder, if you drag the left pane all the way to the bottom you will see a "Lead:  Custom Info" section.  Just drag those fields that you want to retrieve from the left pane to the report preview pane.  Your preview pane should look something like this now:



You're almost done.  All you need to do now is click the "Run Report" button, and then after the report displays, click "Export Details".  This way you will be able to retrieve the Leads information that you have lost.

Please let me know if this works!