Is it possible to leverage SFDC Duplicate Matching fuzzy algorithm’s within APEX code?

I’m hoping to leverage SF’s existing fuzzy matching capability specifically with regards to addresses during a SOQL query or some other lookup mechanism. Before I just implement their solution for myself I’m hoping the functionality is exposed somewhere.

See: Matching Methods Used with Matching Rules

Specifically their fuzzy street matching algorithm (weighting number, street address, and suffix differently).

A lot of my search hits for fuzzy matching or searching have resulted in the effort to ‘dedupe’ data and none seem to have mentioned SF’s built in matching capabilities so I’m pretty pessimistic.

To clarify, this is not in order to prevent duplicates from being inserted. Instead, this is in order to present multiple matches to a consuming service.


Winter ’18 promises to bring the findDuplicates() method to Apex — this has been available to the SOAP API for some time but now you can access the list of duplicate candidates in Apex.

There were some previous ‘workarounds’ that involved trying to INSERT a record and inspect the Exception class to see if it was rejected due to a Duplicate Rule being violated. The findDuplicates() method is far cleaner

Source : Link , Question Author : Joseph Bleau , Answer Author : daveespo

Leave a Comment