Skip to main content
Hi, I'm trying to retrieve all the sharing rules that are set in my org using SOQL/REST, as described in https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm but I'm always an error code "NOT_FOUND", "The requested resource does not exist" although there are sharing rules set in my org. I'd appreciate it if someone can share a code snippet for that.
2 answers
  1. Feb 3, 2021, 8:22 AM
    Hi,

    Greetings!

    You should be able to retrieve the sharing rules if you specify the Object to retrieve the related rules as below:

     

    <?xml version="1.0" encoding="UTF-8"?>

    <Package xmlns="http://soap.sforce.com/2006/04/metadata">

    <types>

    <members>ObjA__c.*</members>

    <name>SharingCriteriaRule</name>

    </types>

    <types>

    <members>ObjA__c.*</members>

    <name>SharingOwnerRule</name>

    </types>

    <version>51.0</version>

    </Package>

    Please try the above package.xml and retrieve to see,if still see the same error.

    Kindly mark it as best answer if it helps so that it can help others in the future.

    Warm Regards,

    Shirisha Pathuri
0/9000