Newer Version Available

This content describes an older version of this product. View Latest

findDuplicatesByIds()

Performs rule-based searches for duplicate records. The input is an array of IDs, each of which specifies the records for which to search for duplicates. The output identifies the detected duplicates for each object that supplies the duplicate rules. findDuplicatesByIds() applies the rules to the record IDs to do the search. The output identifies the detected duplicates for each ID.

Syntax

Usage

Use findDuplicatesByIds() to apply duplicate rules associated with an object to records represented by the record IDs.

findDuplicatesByIds() uses the duplicate rules for the object that has the same type as the input record IDs. For example, if the record ID represents an Account, findDuplicatesByIds() uses the duplicate rules associated with the Account object.

  • All record IDs in the input array must have the same object type, and that type must correspond to an object type that supports duplicate rules.
  • The input array is limited to 50 elements. If you exceed this limit, the SOAP call returns an API Fault Element containing the following fields:
  • ExceptionCode: LIMIT_EXCEEDED
  • exceptionMessage: Configuration error: The number of records to check is greater than the permitted batch size.

Note

For each input ID, findDuplicatesByIds() adds an object to the output array.

Matching is controlled by the values specified by the input record ID. The values can include a record ID only.

findDuplicatesByIds() searches the object defined by the duplicate rule for an existing record that has the same ID. Then it loads the values from that record, and searches for duplicates based on those values.

The output of findDuplicatesByIds() is an array of objects with the same number of elements as the input array, and in the same order. The output objects encapsulate record IDs for duplicate records. Optionally, the output objects also contain values from the duplicate records.

Each element contains a DuplicateResult object. If findDuplicatesByIds() doesn’t find any duplicates for an sObject, the duplicateRule field in DuplicateResult contains the name of the duplicate rule that findDuplicatesByIds() applied, but the matchResults array is empty.

If the includeRecordDetails flag in DuplicateRuleHeader is set to false, findDuplicatesByIds() returns only the record IDs of the matching records. Otherwise, findDuplicatesByIds() returns all the fields specified in the primary CompactLayout associated with the target object.

Basic Steps for Using

  1. Create one or more ID objects that correspond to the object that has the duplicate rules you want to use.
  2. Specify record IDs to compare to records in the object.
  3. Set DuplicateRuleHeader to control the output you want.

Sample

The following Java sample demonstrates how to search for duplicates of a Lead, using the standard Leads duplicate rule.

Arguments

Name Type Description
IDs Array of ID Required. A list of IDs that contain values you want to search for.

Response

An array of FindDuplicatesResult objects.

FindDuplicatesResult

Represents the result of a duplicate search for a single ID in the input array. Because the object associated with the sObject can have more than one duplicate rule, FindDuplicatesResult contains an array of DuplicateResult objects.

Fields

Field Name Field Type Description
duplicateResults Array of DuplicateResult objects The result of each duplicate rule applied by findDuplicatesByIds() to a single sObject.
errors Array of Error objects Contains an array of errors encountered by findDuplicatesByIds().
success boolean This field is set to true if findDuplicatesByIds() doesn’t encounter any errors.