2 thoughts on “Controlling record level security with Sharing

  1. Hi Alba,
    Explained very well, really appreciate your research on sharing!

    I have one doubt, suppose records are being shared by apex sharing based on the record owner field. The records will be shared with the respective manager of the record owner. (Consider there is no role hierarchy)

    Now suppose the record owner got changed and the newly updated record owner has different manager, now the record will be shared using apex sharing with the newly updated owner’s manager.

    What will happen with the previous owner’s manager? Will he be able to see that record because there is an entry in the table with that manager?



    1. If you are using Apex managed sharing (adding sharing rows programmatically), you will need to handle the deletion of the initial sharing row by yourself. If it was manual sharing, this happens automatically. You could detect if the record owner has changed in the object trigger for example, and act accordingly.

      Kind regards


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s