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
elukaweskielukaweski 

cannot find __share objects for my custom objects

Hi....I must be missing something very basic. According to the documentation, when I generate a custom object as Sys. Admin, a corresponding __share object is supposed to be generated. 

 

I cannot find these objects...not when I define then in Apex code (e.g. MyCustomObject__share) nor do they appear when I explore the schema via the IDE.  I must have done something wrong at the basic level, but cannot figure it out.

 

Any help would be appreciated.

 

Thanks

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

There are a couple of reasons why there might not be a share object. First of all, if you have created a Master-Detail relationship on the entity, it disables sharing for that entity, since visibility is controlled by the parent. In this case, you would also notice that the Owner field is missing, since the owner can never be changed, and will always be considered the owner of the parent record. Secondly, it may be that your entity is in Public Read/Write mode. Sharing is only enabled for entities that are not globally accessible (i.e. they must be Read-only or Private). Please check Setup > Security Controls > Sharing Settings for this entity's configuration.

All Answers

sfdcfoxsfdcfox

There are a couple of reasons why there might not be a share object. First of all, if you have created a Master-Detail relationship on the entity, it disables sharing for that entity, since visibility is controlled by the parent. In this case, you would also notice that the Owner field is missing, since the owner can never be changed, and will always be considered the owner of the parent record. Secondly, it may be that your entity is in Public Read/Write mode. Sharing is only enabled for entities that are not globally accessible (i.e. they must be Read-only or Private). Please check Setup > Security Controls > Sharing Settings for this entity's configuration.

This was selected as the best answer
elukaweskielukaweski

Great answer!!! thanks for the thorough explanation.

 

Edwin