function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lakshya KanchanLakshya Kanchan 

Fetch matching rules related to the duplicate rules using apex

Hi

How can we fetch all the matching rules related to the duplicate rules using apex?

Thanks and Regards,
Lakshya
SwethaSwetha (Salesforce Developers) 
HI Lakshya,
Does https://salesforce.stackexchange.com/questions/163619/accessing-a-duplicate-rules-matching-rules-via-apex help?

Thanks
Lakshya KanchanLakshya Kanchan
Hi Swetha

Is there any other approach available?

Regards,
Lakshya
Arun Kumar 1141Arun Kumar 1141
Hi @Lakshya,


To fetch all the matching rules related to duplicate rules using Apex, you can use the Metadata API and the Apex Metadata namespace. The Metadata API allows you to retrieve metadata information, including duplicate rules and matching rules.


The MatchingRule and DuplicateRule objects are used to represent the metadata retrieved from the API.


Note that in order to use the Metadata API in Apex, you need to have the necessary access and permissions. Also, make sure you have the required metadata access enabled for your Salesforce organization.

Hope this helps.

Thank you.