I want to Unshare records by Query which I shared 1 month ago.

List<CustomObject> rec = [SELECT Id, CreatedDate FROM CustomObject WHERE CreatedDate <Whatever Date];

How I can get Shared date from Shared records?


Sharing-table records don't have a CreatedDate field. You can query against their LastModifiedDate, if you need to. Remember that, if the RowCause is Manual, those records could have been modified by users or by other functionality since you created them, and other sharing records could have been modified on the same date.

The safest approach is to write your queries based on how you originally identified the records you wished to share or that you now wish to unshare, not to query based on the modification dates of the sharing records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.