Giter Site home page Giter Site logo

spaulusofficial / findduplicates Goto Github PK

View Code? Open in Web Editor NEW

This project forked from patrick-yan-sf/findduplicates

0.0 1.0 0.0 14.68 MB

Find Duplicates in Salesforce Using

License: BSD 3-Clause "New" or "Revised" License

RobotFramework 22.73% Apex 77.27%

findduplicates's Introduction

SFDX App

This is an apex project that will loop through your contacts/accounts or other duplicate matched objects and create a duplicate record set for the duplicates.  The user can then merge them or perform other operations on the results.

Dev, Build and Test

The code is entirely encapsulated in a single Apex class. This is mostly a proof of concept at this point. So feel free to take the ideas from this and explore better ways to handle the duplicate finding.

The general flow is:

  • Get all the contacts in your org (this is where the batching would be needed) and use the existing salesforce find duplicate function to check if there are duplicates.
  • The code thus depends on the matching rules and duplicate rules that you have defined.
  • Loop through the find duplicate results and create DuplicateRecordSets for each record that has duplicates
  • If Record A might be a duplicate of B or C then the duplicate record set should have 3 record items

How to Use

  1. Setup a Contact Duplicate Rule
  2. Make sure you have some Contacts that would be flagged as duplicates by rule
  3. Open Developer Console
  4. Click File -> New -> Apex Class
  5. Copy the text from DuplicateFinder.cls
  6. Paste in the new Apex Classy file and click File -> Save
  7. Click Debug -> Open Execute Anonymous Window
  8. Paste DuplicateFinder.findAllDuplicateContacts(); and click Execute
  9. Navigate to Duplicate Record Sets and you should see newly created ones related to the potential duplicate Duplicate Record Items which relate to potential duplicate Contacts and the Duplicate Rule

Note: Currently, this method will only evaluate an org with 100 Contacts.

Resources

Description of Files and Directories

  • DuplicateFinder.cls - APEX class with simple POC of the functionality

Issues

There are still many things that needs to be done.

  • The DuplicateFinder class should implement scheduleable and the queueable interface so that it can be run on a schedule and process all the records in the org
  • Currently we simply pass in a list of contacts but the exact fields that need to be selected and the way the contacts are passed in need to be improved.
  • How to handle the duplicates that have already been found? The current list of contacts in a Set will run out of memory.
  • There are no test classes so this would not be deployable yet
  • You can add new fields to the duplicate set and record items objects to store stuff like match confidence or something else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.