function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RelaxItsJustCodeRelaxItsJustCode 

How do you mass delete all manual record sharing?

I'm working on a very old Salesforce instance that has been open until recently.

I have deleted every sharing rule in the enterprise wide sharing setting section.

I have adjusted every security profile in the system.

I have reworked every role in the heirarchy in the system.

But I am having huge issues eliminating the manually shared records to close the gap.

I need help using the dataloader or some other approach to eliminate the records that have been manually shared to groups like "All internal users" at the record level?

Please help me if you can I will give kudos to anyone that can get me across the finish line.

Thank you,
S
Sudeep DubeSudeep Dube
U r want to delete those record which are shred  Hence the solution is in steps :
             For each object record sharing a implicit object that is Object nameSharing is created ...
            like Account object Accountshare will be there U go on workBench
            Select SOQL query and create query like that
          --->select accountid,Userorgroupid from accountshare
Now go to anonomous block and write
           list<Account> acs= [select  ownerid,id from Account];
           list<Accountshare> acsshare=  [select accountid,userOrGroupid from Accountshare];
  List<AccountShare> acstodelete=new List<AccountShare>();       
    for(Account a:acs)
                for(AccountShare as:acsshare)
                    {
                             if(a.id==as.accountid && a.ownerid!=as.userorGroupid)
                            {
                               acstodelete.add(as);
                           }
                    }

   delete acstodelete;
//this code is used to delte shared record for other user except owner.