You are working on a customer referral management system that tracks customer referrals for new leads. You are given two custom Salesforce objects: Customer__c
and Lead__c
. The Customer__c
object has the following fields:
Id
: A unique identifier for the customerName
: The name of the customerEmail__c
: The email address of the customer
Id
: A unique identifier for the leadName__c
: The name of the leadEmail__c
: The email address of the leadStatus__c
: A picklist field with values 'Open', 'Closed', and 'Converted'
Write a Salesforce Apex method that takes in a Lead__c
object as input and returns a list of customers who have referred the lead. A referral is considered valid if the referred customer's email address matches the email address of the lead.
- A
Lead__c
object
- A list of
Customer__c
objects who have made valid referrals for the givenLead__c
object
Lead__c(Id='XYZ123', Name__c='John Smith', Email__c='[email protected]', Status__c='Open')
[
Customer__c(Id='C001', Name='Jane Doe', Email__c='[email protected]'),
Customer__c(Id='C002', Name='Bob Johnson', Email__c='[email protected]')
]