24 votes
Accepted

Disable duplicate check for apex class?

I think you can bypass duplicate check with DMLOptions.DuplicateRuleHeader Class: documentation Sample: Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.AllowSave = true; ...
user avatar
  • 924
15 votes
Accepted

Bypass duplicate when converting a lead

I have yet to find official documentation on this, but the Database.convertLead method actually accepts a second parameter, an instance of Database.DMLOptions. So I believe you should be able to do ...
user avatar
11 votes
Accepted

Duplicate Matching Rules via rest API

The link which you have shared allows the user to bypass the duplicate matching rule defined in salesforce. In REST API, the method will be same. Sharing a code snippet here for enforcing the ...
user avatar
11 votes
Accepted

Why does upsert cause a DUPLICATE_VALUE error?

So, if I understood correctly, you are passing the same key twice in the list, correct? If that's the case, this is documented Upserting Records If the key is matched multiple times, then an error ...
user avatar
  • 7,847
9 votes
Accepted

What is the difference between Report and Alert on the Duplicate Rule means?

The Report option creates a record in the Duplicate Record Item and Duplicate Record Set objects. There is one record created in the Duplicate Record Set object for the occurrence of the the duplicate ...
user avatar
  • 1,160
9 votes
Accepted

How to surpass/ignore Duplicate Management Rules in Apex?

User the DuplicateRuleHeader of the DmlOptions class. The example in the documentation looks like this: Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.allowSave = true; ...
user avatar
  • 434k
7 votes
Accepted

How to keep track of duplicate records across trigger chunks

Personally, one easy thing you can do is to generate digests, and put them into a text field. By generating a large digest, you'll find exact matches with a very low probability of a false positive, ...
user avatar
  • 434k
7 votes
Accepted

Why DuplicateRecordItem is working only after INSERT and not after UPDATE of the dupe-record?

I asked around and @christian-carter indicated that the following statement is indeed true: Is it true, that the Salesforce Standard Lightning Deduplication Component for Lead, Contact and Account ...
user avatar
6 votes

Disable duplicate check for apex class?

Apparently the AllowSave only works if the duplicate rule is an Alert rule, not a Block rule. When you try to save a record that’s identified as a duplicate record by a duplicate rule, you’ll receive ...
user avatar
6 votes
Accepted

Avoid Duplicate Email in Account on Update : Apex

First, you need to get the query outside of your loop. Second, you can do this via Declarative Just set the Email__c field to a Unique field and possibly External Id field if needed. Then it will ...
user avatar
  • 53.1k
6 votes
Accepted

Ignore Duplicate Results Alerts for Visualforce Page

You need to use the DmlOptions.DuplicateRuleHeader class. The isAllowSave method is used to determine if a rule allows saving or not (e.g. provide a warning or an error). The following modification ...
user avatar
  • 434k
6 votes
Accepted

SFDX Disable duplication rules in scratch org

You can include the duplicateRules in your sfdx project tree in a disabled state and when you push them to your new scratch org, they will disable them in your scratch org Example: \main\default\...
user avatar
  • 2,325
6 votes

Mobile Push Demographics data shown multiple device ID for one contact in SFMC

As mentioned in other answers, the DeviceID is generated by the SDK upon its first initialization. It does not change and will be transmitted as part of your device registration. Clearing ...
user avatar
  • 4,138
6 votes
Accepted

How to capture duplicate rules in apex

Yes, the example is in the documentation. // Process the saved record and handle any duplicates public PageReference save() { // Optionally, set DML options here, use “DML” instead of “false” ...
user avatar
  • 434k
5 votes

deduping existng leads and contacts

The two most highly rated free de-duping Apps on the App Exchange are Dupe Catcher and Duplicate Check. Some of the features in the latter are available only in the paid version while everything in ...
user avatar
  • 40.4k
5 votes

Duplicate Matching Rules via rest API

My answer here is the same one I gave on Is it possible to leverage SFDC Duplicate Matching fuzzy algorithm's within APEX code? But for posterity, I figured it should be marked as the correct ...
user avatar
  • 2,325
5 votes

What is the difference between Report and Alert on the Duplicate Rule means?

To add to JodieM's great answer, you can create a custom report type with the primary object being the object you want to find dupes in, and the secondary object being Duplicate Record Items. That way ...
user avatar
5 votes
Accepted

HashCode Deduplication?

Does Apex also have 232 possible values? (looks to me like the same max int) Yes. Can the hashCode values for the same object really change? HashCode means different things ...
user avatar
  • 434k
5 votes

Can anyone suggest a good Mass Duplicate Leads Merge Free tool?

This is probably one of those situations where you have a tradeoff between cost and time. When I (well, me and my intern) needed to sort through roughly 30,000 Contact records to 'deduplicate' and '...
user avatar
  • 48.4k
5 votes
Accepted

Duplicate Rule Details - How to get in Apex exception

You can use DuplicateResult class to get duplicate records detected by duplicate rule. Using Database.SaveResult saveResult = Database.insert(contact, false); get errors and successes. You may need ...
user avatar
  • 3,873
4 votes

How in Visualforce to add the duplication error to a page

You can provide the same functionality in apex using DuplicateRuleHeader class Below is the sample code to get you started Database.DMLOptions dml = new Database.DMLOptions(); dml....
user avatar
4 votes
Accepted

How to show all the duplicates Account Names?

Right now, you're getting a List<AggregateResult>. You need a List<Account> if you want to see the individual records. Probably the simplest way to take what you have already and get what ...
user avatar
  • 143k
4 votes
Accepted

External Id in salesforce

You could use the HAVING clause for this requirement. SELECT External__c, count(Id) records FROM MyObject__c GROUP BY External__c HAVING count(Id) > 1 If you are open to using Apex, you can ...
user avatar
  • 143k
4 votes

Why isn't the DuplicateRecordItem trigger bulkified when triggered by the Automated Process user?

You are not alone! We've seen Duplicate Record Set triggers behave in this way too. Why isn't the DuplicateRecordItem trigger bulkified? It isn't bulkified, because handling intra-import ...
user avatar
4 votes

Query Only Duplicated Records

You must have got a success file stored on your local machine after insertion of records. Take the last files from the two record insertion files and take the id's from them. Delete those id's via the ...
user avatar
  • 1,506
4 votes

Query Only Duplicated Records

I would recommend in an urgent scenario like this (and assuming you have the "power" to be so decisive) using the Developer Console to run some Anonymous Apex to draw out a list and delete the ...
user avatar
4 votes

Want to restrict the duplicate account

The problem that you have is the fact that you are actually querying the same account at update. So, for example: You have an account(A1) with name testAcc and you update some field Trigger fires ...
user avatar
  • 4,972
4 votes
Accepted

Compile Error: line 5:20 no viable alternative at character '"' at line 5 column 20

You can only use single quotes to declare strings, not double quotes. But in this case, you actually need square brackets ([]) to perform your query. List<Account> acc = [SELECT Id FROM Account ...
user avatar
  • 143k
4 votes

Finding potential duplicates from contact record UI. Either using standard matching rules or an app

Well, given that Salesforce has already stated that they cannot activate the matching rule, that means you have to resort to your own programmatic solutions. I'm not sure if there is any AppExchange ...
user avatar
4 votes
Accepted

Non-Duplicates are being detected as duplicates

Based on your explanation: "If two contacts are considered duplicates, they are assigned the same EmailSetId." If the before trigger logic looks for existing contacts and sets the EmailSetId based ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible