Posts

Showing posts with the label RowCause

Salesforce Fact #620 | Access share object records in trigger

Image
While changing the record owner, the sharing records with RowCause='Manual' gets deleted. If we want to access the records for some processing, we need to get them in before update context. In this example, we have an account record with two manual share records. Now, in case of before update we get correct data from the AccountShare table, in after update the records have been deleted. Attached are the screenshots. Note: The code snippet is only for demonstration purpose and coding best practices have not been covered.

Salesforce Fact #616 | Manual sharing removed on ownership changes

We have RowCause="Manual" when a record is manually shared with one or multiple users. When the ownership of the record changes, only shares with this condition are removed from the share object. Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm?_ga=2.118149249.925916126.1675108192-1012046689.1674247969