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
sahitya adminsahitya admin 

FLS for Database.delete

if (!(EMPYRAMDM__UploadedContact_Csv_Dup__c.sObjectType.getDescribe().isDeletable())) {
system.debug('**Cannot Delete the Uploaded Contact CSV Duplicates');
}else{ Database.delete (scope, false);
}
Hi,here is my requirement,I am tirying delete the records from db using database.delete,i had written the above FLS. Even though i got FLS issues.need help in Writing FLS for the above database.delete.urgent requirement.thanks in advance.
Prosenjit Sarkar 7Prosenjit Sarkar 7
Hi Sathiya, 

by this code you are checking OLS (Object level security) not FLS. So, if the current user have a delete permission in his/her profile dat can be deleted. ontherwise not. However, can you please show me the exact error you are facing ?

Thanks, 
Prosenjit
sahitya adminsahitya admin
This query looks for Delete operations that are performed without checking for isDeletable(). This may be a false positive if your code accesses only objects whose security is managed by your app and not the admin (for example OAuth states). It may also be a false positive if checks are performed outside of the dataflow in. References: CRUD Delete result path 1: Similarity Id: -1634949953 Object: scope in file: /classes/MDMDeleteCsvDupBatch.cls L 24: Database.delete (scope, false);
sahitya adminsahitya admin
i got the above message,in checkmark scan
Mohd ZakirMohd Zakir
Hi,

I am getting the same issue.I am using isDeletable to delete the account but In my scanning report same issue is coming.
Pls help me out.

 if (Schema.sObjectType.Account.isAccessible() && Schema.sObjectType.Account.isDeletable()) 
      {
              selectedAccountlist.sort();
            database.delete(selectedAccountlist,false);
      }

User-added image