Solution for Mapping Lead Record Types

Share this article...







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. 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. 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. 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

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.

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!