Admins

Solution for Mapping Lead Record Types

By Ben McCarthy

Introduction

I recently carried out a project for a client where they essentially wanted to use their salesforce org as an umbrella for two companies. I won’t go into too much detail about the reasons for this, but the solution I came up with was to use two record types on each object associated with the sales process. Two record types and page layouts associated with Leads, Accounts, Contacts, Opportunities and a few custom objects as well. It quickly became apparent to me that to follow this process the Lead would have to correctly convert its record type to Accounts, Contacts, Opportunities and any other object involved. Of course by default Salesforce converts to whatever the default record type for the user carrying our the conversion is. This of course is a problem, as users are going to be dealing with both record types from both companies and we can’t have the record types being mixed up throughout the process and possibly losing data behind the scenes.

Mapping Lead Record Types

So the solution I came up with is actually pretty simple if you are familiar with formula fields and workflows. The principle behind it is that you have a duplicate record type field on leads, this is a formula field that mimics whatever is in the standard Salesforce record type field. When you map over everything you will also map over this field to another field you will need to create, we can then use workflows to update the record type in accounts to match whatever is in this “Master” field. I went through a brief moment of annoyance when I realised this will of course only map over to one object as we can’t map to multiple fields. This is again easily solved by creating formula fields on Contacts, Opportunities and any other child record that feed off accounts and mimic this Master field we have created. Confused? I’ll detail how I did this below. Creating and mapping the Master Record Type field So first we need to create a field on Leads that will act as our Master when converting since we cannot convert the Lead Record Type field. Screen Shot 2014-04-24 at 21.59.55 So above is what my fields look likes. Its a simple formula field that just mimics the Record Type name. You can quite easily use the ID or API name if needs be though, it makes no difference. The second thing we have to do is create a read only text field on Accounts. The reason this needs to be read only is because no one is ever going to need to touch it, this is a completely automated process so it needn’t be on the page layout or be editable. Next we need to map this Lead field. Go to Customise>Leads>Fields>Map Lead Fields  and map the Master Record Type to the newly created Account Master Record Type. Screen Shot 2014-04-24 at 22.04.31 So the next stage is to grab this value on accounts for all the other objects you have separate record types for. This is a really simple formula field that needs to be put on every object you need, this is simply just going to mimic the Master Record Type on accounts. Screen Shot 2014-04-24 at 22.19.53   So there it is. This one has been created on Opportunities and again needs to be off the page layout and read only. This is pretty much it for stage one. We have successfully got the Record Type value that the Object NEEDS to be on the record itself. Now to make sure that it matches up.

Updating Records using Workflows So all thats left to do is just make sure that the Record Type matches that of the value in the Master Record Type field we created. We can do this with workflows. You will have to create a new workflow for each record type you have on each object. These workflows are basically going to say. If Master Record Type field = “123” Update Record Type to “123” If Master Record Type field =”456″ Update Record Type to “456” This is just to make sure we are covering all bases. I’ll create an example workflow below using the Opportunity.

  • Click on  Setup | Create | Workflows & Approvals | Workflow Rules
  • Click on New Rule
  • Select Opportunity as the Workflow Object
  • Name your Rule and give it a description
  • Evaluation Criteria should be set as created
  • In the simple formula editor we can set the field as Opportunity, operator as Equals and then the value as the record type we want to update.

Screen Shot 2014-04-24 at 22.42.05

In the second part of the workflow we need to update the record type to reflect what is in the Master Record Type field. As you can see below all I’ve done is selected the field to update as Opportunity Record type, then simply selected the Record type that needs to be updated. Easy!

Screen Shot 2014-04-24 at 22.41.00

The Author

Ben McCarthy

Ben is the Founder of Salesforce Ben. He also works as a Non-Exec Director & Advisor for various companies within the Salesforce Ecosystem.

Comments:

    Arnold Brown
    June 16, 2014 2:56 am
    So to follow this through for my scenario, my org will soon be taking grant proposals via our web to lead form. I've created a "Grant Proposal" lead record type, and a "Grant Proposal" Oppty record type. I generated a web-to-lead form embedding the hidden code to make sure they come back in from the website as "Grant Proposal" lead record type. Do I need to put the hidden formula text field on my lead oject which says "Master record type," or perhaps "Lead Record type?" Can I then map that to a custom Opportunity Object field and trigger workflow based on that field, or do I need to go through the account record in another step before going to the Oppty. It seems this might fail if I go through the Account record and it's a dup account so only the oppty would be created yes? Thanks Arnold.
    Mikael
    August 21, 2014 10:37 am
    Thanks for the step by step solution. This will help to use the varying file types together on one document. I've been having trouble with this so im glad i finally found an article with a solution, thanks.
    Jessi
    October 29, 2014 11:59 am
    Hi , Good solution :) , I have similar problem but with account and opportunity. I have activated person account. Opportunity stages based on the corporate or individual accounts should map to opportunity's individual and corporate record types. If Account -> Corporate account then New Opportunity -> Corporate opportunity and If Account ->Individual account then New Opportunity -> Individual opportunity as of nor whatever the account record type is opportunity shows both record types. Please help !!! Thanks
    ben@ben-mccarthy.com
    October 29, 2014 12:08 pm
    Hi Jess, For this you will need to create a workflow rule on Opportunity. The criteria of this will need to look at Account Record Type and as you have stated, if this is of Corporate record type, you can set the field update to update the Opportunity Record Type. Hope this helps, Ben
    Sarah
    January 29, 2015 1:39 am
    Life saver. Thanks for the tutorial Ben.
    ben@ben-mccarthy.com
    January 29, 2015 9:15 am
    Not a problem Sarah! Hope it helped out.
    Becky
    February 04, 2015 5:54 pm
    Thanks so much for this - what an extremely helpful guide!
    ben@ben-mccarthy.com
    February 04, 2015 6:00 pm
    No problem Becky! Glad you found it helpful.
    Rom
    October 09, 2016 9:12 am
    Hi Ben, thank you for the solution, very helpful. what is the formula in the formula field?
    Adao
    January 26, 2017 7:51 pm
    The formulas used are located in the bottom line of the screenshots.
    Adao
    January 26, 2017 8:14 pm
    Ben, thank you very much for this guide! One question though... In your example, the third step you state "Select CASE as the Workflow Object" but you introduced the example as one for an Opportunity, and the screenshots show the object as the Opportunity. Just wondering if "Case" was meant to be "Opportunity" in the third step of your example?
    Ben McCarthy
    January 28, 2017 9:22 am
    I did! Thank you for that spot, it has been changed.
    Sabina Horrocks
    October 24, 2017 8:00 pm
    How helpful!! Your step by step did exactly what we needed it to!
    Vijay
    January 31, 2018 4:44 pm
    Ben, I have a quick question. I have record types enabled at Lead level and while lead conversion i have some record types at account level to display different fields at each page Layout based on the record type that is being selected. i still see that user has to select the Account record type name fro the drop down during lead conversion. Is there a way to avoid it map it using workflow field update. Please help.
    Angela
    March 22, 2019 12:45 pm
    Hey Ben, I know this is an old post but its the closest thing I could find. I am trying to find a point to click online form that captures an entire family for Salesforce. Seems simple but the instance has Record Type A is a Parent Contact and Record Type B is a Kiddo Contact. So the form may capture one or two parents (record type A) AND it caputres 1+ kiddo contacts (record type B). I have been trying to figure something out for several months. Any direction you can point me in would be AWESOME.
    Nilesh M
    June 21, 2023 7:00 am
    Hi Ben, Hope you are doing well. It would be great if you could help me out. In my scenario, I have multiple record types on Opportunity. On Lead I have one field named as Business which is relatable to Opportunity record type. Once lead is created, If I select business as XYZ , then on lead conversion page, on opportunity showing default record type selected but every time I need to select record type , based on that I was able to create a correct opportunity based on lead creation. How to tackle this situation, If user couldn't be able to select the record type then that would be create a problem.

Leave a Reply