
2 个回答
Hi,
You are accessing DeleteLead out side of if condtion please use like this.
Mark as a best if it helps you.public with sharing class DML_Delete {
public static void RecordsDeletefromLead (String StartText){
if(StartText != null && StartText != ''){
StartText +='%';
List<Lead> DeleteLead = new List<Lead>();
DeleteLead = [select id,Company from Lead where Company Like:StartText];
System.debug('DeleteLead'+DeleteLead);
if(DeleteLead.size()>0){
delete DeleteLead;
}
}
}
}
Regards,
Suraj