Create Cases from Lead Object
- Kriss Lugo
- May 13, 2021
- 3 min read
Based on this Idea.

What if the prospect filled out the wrong form? What is they are on a trial? What if...?
I'm going to be honest; for this solution you will need 5 new custom objects, 6 flows, 3 VF pages and you will be ready to roll! If all of that doesn't scare you then keep reading.
Let's start... Create a new lookup field under Cases for Leads (obvious rigth?!)
Now because I was lazy today but still wanted to give you something I kind of added to solutions within the same solution; so you can adjust as you need. I'm also open to suggestions or further questions you may have.
We are going to create our first flow: Screen flow
SCREEN ELEMENT 1: I wanted to give you 2 options to handle this solution:
(a) You will create an Account and contact our of your lead (without converting it) so you still connect the case to the account/contact
(b) You relate the lead to the case
So, add a picklist component with 2 choices. To make it easy for me I called them:
(a) Convert = true
(b) No Convert = false
SCREEN ELEMENT 2: You may don't need it but I wanted to add the subject line and the description of the case. Maybe you add a field for internal notes or nothing at all.
Add the following components:
Text (Subject) /* I made it requried
Log Text (Description)
GET RECORD - LEADS: We will get all the Lead info because we need it.
Object: Lead
Condition Requirements: Id = recordId
*recordId is a resource / Type = variable, available for input and output
Only the first record
Automatically store all fields
GET RECORD - CONTACTS: We want to find if there is a duplicate contact (just in case!) so we will use the Lead email address to find a duplicate.
Object: Contact
Condition Requirements: Email = Lead from GET RECORD - LEAD > Email
Only the first record
Choose fields and let Salesforce do the rest
Account Id
ID
DECISION 1: Let's check if there is an existing contact
Outcome 1: YES
Condition Requirements to Execute Outcome: AND
GET RECORD - CONTACTS Is Null false
Outcome 2: NO
When there is in fact a contact with the same email then:
CREATE RECORD - CASE: We will create a case for the existing contact/account
How many records: One
Use separate resources, and literal values
Object: Case
Here you will select the fields you want. In this example I selected:
AccountId = GET RECORD - CONTACTS > Account ID
ContactId = GET RECORD - CONTACTS > Contact ID
Description = Description
Subject = Subject
Origin = Web
OwnerId = Case Queue (*)
Status = New
(*) I'm lazy today and hard coded the Queue Id, but please make sure you add a GET RECORD to find the Queue Id. It's better practice in case you are testing in different envrioments and for deployment

DECISION 2: We want to figure out if we need to create a new account/contact or if we just link the case to the Lead
Outcome 1: Case Option = True
Outcome 2: Case Option = False
When the answer is TRUE then:
CREATE RECORD - ACCOUNT: We will create an account (we won't convert the lead so it's still on the Sales rep radar)
How many records? One
Use separate resources, and literal values
Object: Account
Enter and map all the fields you need
Manually assign variables = TRUE
Variable: NEW_ACCOUNT_ID
(*) NEW_ACCOUNT_ID is a resource. Type = Text, available for input and output
CREATE RECORD - CONTACT: We will create a contact (we won't convert the lead so it's still on the Sales rep radar)
How many records? One
Use separate resources, and literal values
Object: Contact
Enter and map all the fields you need
Manually assign variables = TRUE
Variable: NEW_CONTACT_ID
(*) NEW_CONTACT_ID is a resource. Type = Text, available for input and output
CREATE RECORD - CASE: We will create the case and assign it to the new contact/account
How many records? One
Use separate resources, and literal values
Object: Case
Enter and map all the fields you need
AccountId = NEW_ACCOUNT_ID
ContactId = NEW_CONTACT_ID
Description = Description
Subject = Subject
Origin = Web
OwnerId = Case Queue (*)
Status = New
When the decision is to link the case to the lead then we add a CREATE RECORD - CASE
How many records? One
Use separate resources, and literal values
Object: Case
Enter and map all the fields you need
LeadId = GER RECORD - LEAD > Lead ID
Description = Description
Subject = Subject
Origin = Web
OwnerId = Case Queue (*)
Status = New
Here is your final flow:

Now go to the Lead object and create a Quick Action Button (Flow) and add it to the Lead Page.
We still have one more step... We want to make sure that when a Lead is converted the cases are assigned to the contact/account. I'll show you this later so hang in there!
Comments