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

how to create a task assigned to leadowner when the duplicate lead is found.
Hi ,
Im using trigger and class to check the duplicate lead using email and phone.It is working.When a lead exists a task should create under original lead and assigned to leadowner.How can i achieve this?
thanks
Im using trigger and class to check the duplicate lead using email and phone.It is working.When a lead exists a task should create under original lead and assigned to leadowner.How can i achieve this?
thanks
Once you find a duplicate lead, are you updating any field on Lead indicating it as duplicate lead. You can use the below in your existing code to create the task :
List <Lead> duplicateLead = [SELECT ID, Status FROM Lead WHERE Status = 'Duplicate'];
List <Task> taskToInsert = new List<Task> ();
for (Lead l : duplicateLead) {
Task t = new Task ();
t.Subject = 'Duplicate Lead';
t.WhoId = l.Id;
taskToInsert.add(t);
}
insert taskToInsert;
Let me know how it goes.
Thanks,
Shravan