0

This question already has an answer here:

I was using Apex Sharing and it was working fine, but then I noticed that for some objects when I use CustomObject__Share it says 'Entity is not org-accessible'. I tried to google it, but wasn't able to find any info on why I can't access Apex Sharing Objects.

marked as duplicate by Adrian Larson, Community Sep 8 '16 at 11:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

You can't share any objects where the Org-Wide Sharing Default for it is Public Read/Write. Similar to how you can't set the sharing default to that level if you already use Apex sharing.

From Set Your Organization-Wide Sharing Defaults:

The organization-wide default settings can’t be changed from private to public for a custom object if Apex code uses the sharing entries associated with that object. For example, if Apex code retrieves the users and groups who have sharing access on a custom object Invoice__c (represented as Invoice__share in the code), you can’t change the object’s organization-wide sharing setting from private to public.

  • Thanks, my bad. Haven't thought that if Sharing Settings set to Public Read/Write it will result as an error. Thanks for help – ytiq Sep 8 '16 at 11:42

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