Salesforce Fact #620 | Access share object records in trigger

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.

Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow