how can we display tasks of contact object in vf page using custom controller and also view and edit the task by adding view and edit link with each row of task.
May I suggest you please refer to the sample code below and tweak it as per your requirement which whould help.
Apex Controller:
public class contactActivityHistory {
public Task[] getListTasks() {
List<Contact> cntct = [SELECT Id, Name FROM Contact];
List<Id> contactIds = new List<Id>();
for(Contact cn : cntct) {
contactIds.add(cn.Id);
}
List<Task> tskList = [select whoid,subject,status,LastModifiedDate from task where whoid in : contactIds order by LastModifiedDate desc];
return tskList;
}
}
Kindly mark this as solved if my reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
May I suggest you please refer to the sample code below and tweak it as per your requirement which whould help.
Apex Controller: Visual Force Page: How to view and edit the task by adding view and edit link with each row of task:
- https://developer.salesforce.com/forums/?id=906F000000098LyIAI
Hope this helps.Kindly mark this as solved if my reply was helpful so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.
Thanks,
Nagendra