You need to sign in to do that
Don't have an account?

Error:Variable does not exist: DeleteLead
Hi...
ALL
i want to delete Lead Records Based on the company name.But i am facing this Error any one can can support me.
public class DML_Delete
{
public static void RecordsDeletefromLead (string StartText)
{
if(StartText !='Null' && StartText !='')
{
StartText +='%';
Map<id,Lead> DeleteLead =new Map<id,Lead> ([select id,Company from Lead where Company Like:StartText]);
}
if(!DeleteLead.isEmpty())
{
delete DeleteLead;
}
}
}
ALL
i want to delete Lead Records Based on the company name.But i am facing this Error any one can can support me.
public class DML_Delete
{
public static void RecordsDeletefromLead (string StartText)
{
if(StartText !='Null' && StartText !='')
{
StartText +='%';
Map<id,Lead> DeleteLead =new Map<id,Lead> ([select id,Company from Lead where Company Like:StartText]);
}
if(!DeleteLead.isEmpty())
{
delete DeleteLead;
}
}
}
Hi,
You are accessing DeleteLead out side of if condtion please use like this.
Mark as a best if it helps you.
Regards,
Suraj
All Answers
So code will be like belwo. Please mark it as solution if it solved your problem.
Hi,
You are accessing DeleteLead out side of if condtion please use like this.
Mark as a best if it helps you.
Regards,
Suraj