Hello, if you are facing any challenge like when one record (account) shared with other user but all records (opportunities, contacts, lead, etc.) related to parent record is also shared.
By default, Relationship behavior between two entities is parental. We can control this behavior of sharing records.
Parental Relationship: One or more actions that are performed on the primary record are also performed on the related records (Cascade All). For example, if a primary record is assigned, the related records are also assigned.
When you want to control the sharing of related records then we need to change the type of behaviour.
Referential Relationship: Actions that are performed on the primary record are not performed on the related records (Cascade None).
Referential, Restrict Delete: Cascade None, Delete: Restrict Delete
Configurable Cascading: Actions that are performed on the primary record are performed on the related records by default (cascade all), although we can configure the rules however we want to.
After selecting Type of Behavior to Configurable Cascading, Change Cascading All to other cascading option according to the requirement.
Let us first we understand all cascading options.
Cascade All: Perform the action on all related entity records.
Cascade Active: Perform the action on all related entity records that have a status of active.
Cascade User-Owned: Perform the action on all related entity records that are owned by the same user as the owner of the primary entity record. You cannot use this option if one of the entities in the relationship has ownership at the organization level. (Note: for the assign action, this means the owner before the reassignment, not the new owner).
Cascade None: Related entity records are not affected.
The options for Delete operation:
Cascade All: Delete all related entity records.
Remove Link: Clear the lookup field for this relationship, so that the related record remains in the system and is no longer associated with a parent record through this relationship.
Restrict: This rule prevents the primary entity record from being deleted if any related entity records exist. Related records are not affected.
In this way, we can change the behavior of related records according to the requirements like cascade only active related records (Cascade Active), etc.