Apex trigger on Account to avoid creation of duplicate record if the account with same phone exists in the system in Salesforce | Write a trigger on Account to Prevent the user to create duplicate Account based on Phone if Phone number is already exist in Salesforce

Create Apex Trigger →

Step 1:- Create Apex Trigger : checkDuplicationPhoneAccTrigger.apxt

checkDuplicationPhoneAccTrigger.apxt [Apex Trigger]

Further post that would you like to learn in LWC FAQ (Frequently Asked Questions)

How do you prevent creating duplicate records in Salesforce using trigger?

Preventing duplicate records in Salesforce based on a single field can be achieved using a Set that can store the values of that specific field from all existing records and compare it with the list of new records that are going to be inserted.

How can you prevent duplicate leads from being created?

Block sales reps from creating duplicate leads. In the Standard Lead Duplicate Rule, select Block instead of Allow. With the Standard Lead Duplicate Rule set to block duplicates, a rep can click to view duplicates of leads but can’t save a new lead.

What is matching rule and duplicate rule in Salesforce?

Matching rules and duplicate rules work together to ensure that your sales teams work with data that’s free of duplicates. Before your reps save new and updated records, matching rules and duplicate rules provide warnings of potential duplicates. You manage matching rules and duplicate rules in Setup.

Final Output → Get source code live demo..

--

--

Easy to learn step-by-step online tutorial by www.w3web.net

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vijayk

Vijayk

Easy to learn step-by-step online tutorial by www.w3web.net