We have an object whose Org-Wide default sharing setting is set to Private.

When an Admin changes a Picklist to Full Access, we have to insert CustomObject__Share records for all users, and potentially delete old __Share records.

We are doing this in a batch process, but if there are more than 10k users, even if the scope is 1 it fails since we would be inserting more than 10k records.

Is there any way to get around this? Is it possible to change the Org-Wide default to Read/Write programatically? Or maybe do it on a profile basis rather than individual users?


One option would be to have a Group that contains all the users. Then you need to only create one share record that shares with that group.

  CustomObject__Share cShare = new CustomObject__Share();
  cShare.ParentId = recordId;
  cShare.UserOrGroupId = groupId; // Group contains all users"
  cShare.AccessLevel = 'Edit';
  cShare.RowCause = Schema.Job__Share.RowCause.Manual;

See the documentation for more info on sharing

  • 1
    I think this would work fine. There is an "All Internal Users" Public Groups option that means we wouldn't need a trigger if extra users are added. – George S. Mar 10 '14 at 14:59

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.