+ Start a Discussion
rohitash yadav 8rohitash yadav 8 

display List of Leads with call, task in Visualforce page


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?

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']) {


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