+ Start a Discussion
rohitash yadav 8rohitash yadav 8 

display List of Leads with call, task in Visualforce page

Hi,

I need to show a list of those leads in my visualforce page on which any task or call is created. I have wrote the following query but it is not working.

Select Id, Name from Lead where Id IN (SELECT Who.Id FROM Task where Who.Type='Lead') limit 10

Can anyone help me?

Thanks,
Rohitash
Sukesh Kumar 33Sukesh Kumar 33
Try the following code
List<Lead> lstLeadToDisplay = new List<Lead>();
Set<Id> setLeadId = new Set<Id>();

for(Task objTask :  [SELECT Who.Id FROM Task where Who.Type='Lead']) {

	setLeadId.add(objTask.Who.Id);
}

lstLeadToDisplay = [Select Id, Name from Lead where Id IN : setLeadId];