Apex Trigger to Check Duplicate Email on Lead Object -- w3web.net

Write a trigger on lead to prevent duplicate records based on lead email Whenever the records is inserted Or updated using apex class handler trigger in Salesforce | How to prevent duplicate lead records based on email in apex trigger Salesforce

Hey guys, today in this post we are going to learn about How to Check Duplicate Email on Lead Object in Salesforce.

Real time scenarios:- Write a trigger on lead to prevent duplicate records based on lead email, if a record already created with the same Email, Or record is Updated. The trigger should throw an error.

Files we used in this post example

duplicateEmailCheckLead.apxt Apex Class Trigger It will be fired whenever New Lead is Created Or Updated
leadHandlerController.apxc Apex Class Controller Apex handler trigger to prevent duplicate records based on lead email.
Standard Object:- Lead Trigger to prevent duplicate lead based on email.

Final Output

Apex Trigger to Check Duplicate Email on Lead Object -- w3web.net

Other related post that would you like to learn.

  • Find the below steps for this post.

Create Apex Trigger

Step 1:- Apex Class Trigger : duplicateEmailCheckLead.apxt

From Developer Console ➡ File ➡ New ➡ Apex Trigger

duplicateEmailCheckLead.apxt [Apex Class Trigger]

Create Apex Class Controller

Step 2:- Create Apex Class : leadHandlerController.apxc

From Developer Console ➡ File ➡ New ➡ Apex Class

leadHandlerController.apxc [Apex Class Controller]

Apex Trigger to Check Duplicate Email on Lead Object -- w3web.net

Further post that would you like to learn in LWC

Related Topics | You May Also Like

Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio]

4 thoughts on “Write a trigger on lead to prevent duplicate records based on lead email Whenever the records is inserted Or updated using apex class handler trigger in Salesforce | How to prevent duplicate lead records based on email in apex trigger Salesforce”

Leave a Comment