18

I think you can bypass duplicate check with DMLOptions.DuplicateRuleHeader Class: documentation Sample: Database.DMLOptions dml = new Database.DMLOptions(); dml.DuplicateRuleHeader.AllowSave = true; Account duplicateAccount = new Account(Name='dupe'); Database.SaveResult sr = Database.insert(duplicateAccount, dml); if (sr.isSuccess()) { System.debug(...


14

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 something like: Database.LeadConvert lc = new Database.LeadConvert(); //some parameters are set here Database.DMLOptions dml = new Database.DMLOptions(); dml....


10

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 insertion of duplicate records and fetching the already existing duplicate records. The method simply creates an Account and returns the list of duplicate accounts ...


10

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 is generated and the object record is neither inserted or updated.


9

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 and one record for each record found by the duplicate rule in the Duplicate Record Item object. To use it, you have to create a Report Type that looks at ...


9

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; dml.DuplicateRuleHeader.runAsCurrentUser = true; Account duplicateAccount = new Account(Name='dupe'); Database.SaveResult sr = Database.insert(duplicateAccount,...


7

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 is NOT based on DuplicateRecordItem, but on something else? Again from Christian, the Lightning Component uses the dedupe function similar to what was formerly ...


6

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, and even be able to use unique indexes to enforce deduplication with virtually zero effort. There's several different possible combinations you could go for, ...


6

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 let you save if no other Accounts have that email but produce an error if other accounts have that email. Null values are allowed and do not trigger the unique ...


6

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 should suffice: public PageReference saveAll() { update childlist; List<Child__c> children = new List<GrandChild__c>(); ...


6

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\duplicateRules\Contact.Standard_Contact_Duplicate_Rule.duplicateRule-meta.xml The contents of that file: <?xml version="1.0" encoding="UTF-8"?> <...


5

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 Dupe Catcher is completely free. As part of full disclosure, I'm not financially associated with either company but have met some of the employees of Symphonic ...


5

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 answer for this question too: Winter '18 promises to bring the findDuplicates() method to Apex -- this has been available to the SOAP API for some time but now ...


5

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 a duplicate error. If the duplicate rule contains the Allow action, an attempt will be made to bypass the error. Documentation


5

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 you can report on fields on the object, rather than just seeing if a record is a dupe or not.


5

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 in different contexts. Since I do play with them from time to time, I know that the implementations are pretty consistent, but not across data types. For example:...


5

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 'merge' when my org implemented the feature to allow Contacts to be related to more than one Account, we used Microsoft Excel to handle the bulk of the work. The ...


5

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 to do few tweaks in code to get duplicate records. for (Database.Error error : saveResult.getErrors()) { if (error instanceof Database.DuplicateError) { ...


4

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.DuplicateRuleHeader.allowSave = true; dml.DuplicateRuleHeader.runAsCurrentUser = true; Account duplicateAccount = new Account(Name='dupe'); Database.SaveResult sr = Database....


4

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 you want is to collect a Set<String> duplicateNames then add another query. Set<String> duplicateNames = new Set<String>(); for (...


4

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 generate a Set<String> based on the above. If your volume is low enough, you can do it all in one go: Set<String> externalIds = new Set<String>(); ...


4

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 duplicates requires letting the records go in 1-by-1. Duplicate Management is a very clever black box, and maybe we're making some assumptions about the low level ...


4

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 data-loader.


4

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 duplicate records Looking at your data you can probably use the CreatedDate (and maybe the CreatedById field to narrow to the user) field to determine whether the ...


4

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 on update You query accounts WHERE Name = 'testAcc' Aaaaand... You get that A1 in your query! As the result, you will addError() on A1 which will prevent it ...


4

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 WHERE Name=:a.Name AND Rating=:a.Rating]; That will get your code to compile. You still need to bulkify, however. You might consider just using out of the box ...


4

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 app that may resolve your use case, but there are some classics like DupeCatcher, for example. Assuming apps like DupeCatcher don't solve your problem, I think ...


4

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 on the emails of the incoming records as well as any existing records, then the duplicate rule is marking those records while you are inserting them and that ...


4

you are using the wrong way of variable binding. Is implemented by means of : colon symbol, that should be in your soql: List<Account> acc=[Select id from Account where Name = :a.Name and Rating = :a.Rating]; by the way, you are using SOQL in a loop, that is very bad and is in opposition to trigger best-practices Best Practice #2: Avoid SOQL ...


4

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 application data, wiping phone data, doing a factory reset, upgrading your phone to a new device (the SDK does not backup data for future restores after data wipes or ...


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