public with sharing class CaseActivityController {
public List<Task> lstTask {get;set;}
public CaseActivityController(ApexPages.StandardController std)
{
Id AccountId = std.getId(); //Get AccountId
//Query on Case
Map<Id, Case> mapIdToCase = new Map<Id,Case>([Select Id from Case where AccountId =: AccountId]);
//Query on Case Activity
lstTask = new List<Task>([SELECT CallType,Status,Subject,WhatId FROM Task where WhatId IN: mapIdToCase.keySet()]);
}
}
This will return only Task records. If you want to pull Event records please write code for the Event.
I have created a Inline VF page on Account detail page which will pull the related Case records Activity. Please refer below code:
VF Page Code:
Controller Code:
This will return only Task records. If you want to pull Event records please write code for the Event.
Thanks,
Prem Anandh