deleteS3Files
This method is used to delete files from the S3 bucket. It does not delete the S-Drive file records, so that needs to be done separately.
cg.SdriveTools.deleteS3Files(List awsLocationList, List versionIdList)
Parameters:
awsLocationList is the Key__c field
versionIdList is the version_id__c fields.
This returns void if the delete is successful and an exception if unsuccessful.
Example code:
List<cg__CaseFile__c> caseFiles = Database.query('Select id, cg__Key__c, cg__Version_Id__c from cg__CaseFile__c');
List<String> awsLocationList = new List<String>();
List<String> versionIdList = new List<String>();
for(cg__CaseFile__c caseFile : caseFiles)
{
awsLocationList.add(caseFile.cg__Key__c);
versionIdList.add(caseFile.cg__version_id__c);
}
cg.SdriveTools.deleteS3Files( awsLocationList, versionIdList);
//After delete from s3 is successful you should delete the records Salsforce as well like below.
delete caseFiles.
Â