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
Ishan Goyal 9Ishan Goyal 9 

How can I do inhertance based sharing in salesforce with coding?

I want to create a senario of Parenet child in Sharing i.e If I am able to see any field that that field should be visible to all the childs too. I have to do this by doing coding. Is there any way to do it without coding?
AnudeepAnudeep (Salesforce Developers) 
Hi Ishan, 

Salesforce provides implicit sharing between accounts and child records (opportunities, cases, and contacts), and for various groups of portal users.

https://help.salesforce.com/articleView?id=sharing_across_objects.htm&type=5

Child implicit sharing is providing access to an account’s child records to the account owner. This access is defined at the owner’s role in the role hierarchy. Child implicit sharing only applies to contact, opportunity, and case objects (children of the account)

https://blog.bessereau.eu/assets/pdfs/sharing_architecture.pdf

For custom objects, I guess you have to go with Apex Sharing

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm

If the above information is helpful, please mark as Best Answer so that it can help others in future
 
andy perezandy perez
Actually, I am very much confused that how does sharing work in Salesforce?
AdiiAdii
How to solve this trigger on junction object..............Create a junction object named ‘Job Application’ between two objects named ‘Position’ and ‘Candidate’.The position and candidate has many to many relationships which will be established due to the junction object. Create a status field of type picklist on both position and candidate. If the status on a candidate record is updated to ‘Approved’, the status field on position should be updated to ‘Approved’ only if status on all related candidates have been updated to ‘Approved’.
Naman SinglaNaman Singla

Hi Ishan,

I hope you are doing well and safe in lockdown time!

If I am not wrong I guess your question is - How can I do inhertance based sharing in salesforce WITHOUT coding?

Because as you wrote in decription of your question that - 'I want to create a senario of Parenet child in Sharing i.e If I am able to see any field that that field should be visible to all the childs too. I have to do this by doing coding. Is there any way to do it without coding?'

See, Sharing inheritance is essential for access accuracy and for a more connected working of different stakeholders. Master-Detail Relationships enable you to set the Sharing Settings to allow child records to inherit visibility from the parent which Lookup Relationships don’t. So, when a child record is associated with an Account in Lookup Relationship, you need to rely on the Apex Managed Sharing which was taking my time when I tried doing it.

So, at that time I came accross a product which helps me do it easily and fastly. Its name is Shareit-o. ShareIT-O helps me with Inheritance-Based Sharing to alleviate the complexities in sharing Lookup objects. You can also try it. Its link is: https://www.manras.com/shareit-o/

 

If the above information is helpful, please mark as Best Answer so that it can help others in future.

Cheers!