I'm trying to access the matching rules associated to a Duplicate rule via code. Through the UI, it's easy enough to create a Duplicate Rule then add Matching rules to it. So I know there has to be a link between these objects, but I can't seem to find any documentation on how to make this link through code.

Here is an idea of what I'm trying to do. (which obviously does not work)

SELECT Id, DuplicateRuleId (<- not correct, but this is what I need) FROM MatchingRule WHERE DuplicateRuleId = (Some specific Duplicate Rule Id)

Does anyone have any ideas on how this would be possible?


There is nothing in the describe information that points to a link between the two accessible in SOQL or Apex. I can't find any documentation that shows where you can retrieve the related matching rule from the duplicate rule or vice versa in SOQL or Apex.

You can do this with the Metadata API if that's an option. The duplicateRuleMatchRules property contains a list of the related matching rules for the retrieved duplicate rule.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.