-
Notifications
You must be signed in to change notification settings - Fork 0
The Duplicates.MatchResult Class
GitHub Action edited this page Nov 11, 2025
·
1 revision
Represents the results from a specific matching rule within a duplicate detection operation.
This class wraps Datacloud.MatchResult and contains matched records and any errors encountered during matching.
| Property Name | Data Type | Details |
|---|---|---|
| entityType | String | The entity type for this match result. Read-only. |
| errors | List<Database.Error> | List of errors that occurred during matching. Read-only. |
| matchEngine | String | The name of the match engine used for this result. Read-only. |
| matchRecords | List<Duplicates.MatchRecord> | List of matching records found by this rule. Read-only. |
| rule | String | The name of the duplicate rule that generated this match result. Read-only. |
| size | Integer | The number of matching records found. Read-only. |
| success | Boolean | Indicates whether the match operation was successful. Read-only. |
Returns the entity type for this match result.
String getEntityType()
Duplicates.MatchResult matchResult = dupResult.getMatchResults()?.get(0);
String entityType = matchResult?.getEntityType();Returns any errors that occurred during matching.
List<Database.Error> getErrors()
if (!matchResult.isSuccess()) {
for (Database.Error error : matchResult.getErrors()) {
System.debug('Error: ' + error.getMessage());
}
}Returns the match engine used for this result.
String getMatchEngine()
String engine = matchResult?.getMatchEngine();
System.debug('Match Engine: ' + engine);Returns the matching records.
List<Duplicates.MatchRecord> getMatchRecords()
for (Duplicates.MatchRecord matchRecord : matchResult.getMatchRecords()) {
System.debug('Match: ' + matchRecord.getRecord());
}Returns the rule name for this match.
String getRule()
String ruleName = matchResult?.getRule();
System.debug('Rule: ' + ruleName);Returns the number of matching records.
Integer getSize()
Integer matchCount = matchResult?.getSize();
System.debug('Found ' + matchCount + ' matches');Returns whether the match operation was successful.
Boolean isSuccess()
if (matchResult?.isSuccess()) {
System.debug('Match operation succeeded');
}Returns the underlying native Datacloud.MatchResult instance.
Datacloud.MatchResult toDatacloudType()
Datacloud.MatchResult nativeResult = matchResult?.toDatacloudType();Duplicates.FindDuplicatesResult result = DatabaseLayer.Duplicates.findDuplicates(account);
for (Duplicates.DuplicateResult dupResult : result.getDuplicateResults()) {
for (Duplicates.MatchResult matchResult : dupResult.getMatchResults()) {
System.debug('Rule: ' + matchResult.getRule());
System.debug('Engine: ' + matchResult.getMatchEngine());
System.debug('Matches: ' + matchResult.getSize());
for (Duplicates.MatchRecord matchRecord : matchResult.getMatchRecords()) {
System.debug(' Duplicate: ' + matchRecord.getRecord());
}
}
}- Generating Test Records
- Dml
- Soql
- Cmdt
- Duplicates
- Plugins
- DatabaseLayer
- Dml
- MockDml
- MockRecord
- Cmdt
- MockCmdt
- Duplicates
- MockDuplicates
- MockSoql
-
Soql
- Soql.AggregateResult
- Soql.Aggregation
- Soql.Binder
- Soql.Builder
- Soql.Condition
- Soql.ConditionalLogic
- Soql.Criteria
- Soql.Cursor
- Soql.Function
- Soql.InnerQuery
- Soql.InvalidParameterValueException
- Soql.LogicType
- Soql.NullOrder
- Soql.Operation
- Soql.Operator
- Soql.ParentField
- Soql.PreAndPostProcessor
- Soql.QueryLocator
- Soql.Request
- Soql.Scope
- Soql.Selectable
- Soql.SortDirection
- Soql.SortOrder
- Soql.Subquery
- Soql.TypeOf
- Soql.Usage
- Soql.WhenClause