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
Micky MMicky M 

Sharing Object

Hi all,

 

I'm trying to share a record with certain users when they are assigned via a lookup (on Project_Activity__c) but i cant find the sharing object, i have a custom object Project__c but there isnt a sharing object Project_Share do i have to generate this somehow? the project is the master in a master detail relationship with Project_Activity__c. I've got the sample code from salesforce and it all looks ok but im getting invalid type Project_Share as this object doesnt exist, does anyone know what i need to do?

 

Thanks Guys

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Also, there is no __Share object for custom objects that are "Controlled by Parent", since the sharing depends on the parent record(s).

All Answers

JohanLiljegrenJohanLiljegren

Try Project__Share - note the double underscores.

Micky MMicky M

yeah sorry that was a typo when i put it on here it is Project__Share (double underscore) but there isnt an object of that name in the database? is there something i have to do to generate it?

hemantgarghemantgarg

Share objects only exists if that object has private or public read-only in org-wide-default settings. Please check the org-wide-deafult setting for project__c.

sfdcfoxsfdcfox

Also, there is no __Share object for custom objects that are "Controlled by Parent", since the sharing depends on the parent record(s).

This was selected as the best answer
Micky MMicky M

Yeah thats exaclty the reason why the __share wasnt there!!!! thanks for your help guys!

softectonicsoftectonic

What is the trick for sharing objects on the detail side of master detail relationship that are "Controlled by Parent"? The master in this case is Account object. Should sharing be done with Apex managed sharing on AccountShare object since there is no __Share object for related custom objects?

hemantgarghemantgarg

There is no independent sharing on detail records, so sharing should be done on Account via AccountShare object. When parent is shared, details should automatically be shared.

softectonicsoftectonic

Could one use AccountShare in Apex for sharing master detail records between two partner portal accounts?