2

I am trying to deploy Sharing rules (Criteria Based) from one Org to another Org using eclipse and when I try to do it gives an error "Component type not permissible in destination Organization".

  • please check object OWD in target organization. – Himanshu Jan 18 '16 at 20:08
  • Thank you everyone for responding..I was able to retrive the sharing rules from Source org but the issue is when I try to deploy to target Org using eclispe it doesn't allow to deploy and the error says "Component type not permissible in destination Organization" and the Next button is greyed out. – Vijay Kalidindi Jan 20 '16 at 19:56
  • I check the OWD settings and they are same from source to Target org. – Vijay Kalidindi Jan 20 '16 at 19:56
  • What are the API versions of your source org and target org? Sharing rules changed with v 33. – Rob Alexander Jul 6 '16 at 22:38
4

In the project metadata, all the sharing rules will be inside a folder named "sharingRules" and each of them will be named as "ObjectAPIName.sharingRules"

The package.xml should mention the sharing rule correctly as "ObjectAPIName.SharingRuleName" and it must come under the correct type in package.xml. A sample package.xml is:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Lead.testShareRule</members> 
         <name>SharingCriteriaRule</name>
    </types>
    <types>
        <members>*</members> 
        <name>SharingOwnerRule</name>
    </types>
    <types>
        <members>Account.*</members>
        <name>SharingTerritoryRule</name>
    </types>
    <version>33.0</version>
</Package>

A sample file of sharing rule is :

<?xml version="1.0" encoding="UTF-8"?>
<SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
    <sharingCriteriaRules>
        <fullName>AccountCriteriaShareWithCEO</fullName>
        <accessLevel>Edit</accessLevel>
        <accountSettings>
            <caseAccessLevel>Read</caseAccessLevel>
            <contactAccessLevel>Edit</contactAccessLevel>
            <opportunityAccessLevel>Edit</opportunityAccessLevel>
        </accountSettings>
        <criteriaItems>
            <field>Name</field>
            <operation>startsWith</operation>
            <value>Test</value>
        </criteriaItems>
        <description>my account criteria rule description</description>
        <label>AccountCriteriaShareWithCEO</label>
        <sharedTo>
            <role>CEO</role>
        </sharedTo>
    </sharingCriteriaRules>
</SharingRules>

Also please see the following links:

  1. Sharing rules in the metadata api - https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_sharingrules.htm
  2. Package.xml for sharing rules - https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/manifest_samples.htm#manifest_sharing

Thanks

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.