Map<Id, Integer> mapActivityHistoryCountToCase = new Map<Id, Integer>();
for( Case caseObj : [SELECT count(SELECT ID FROM ActivityHistories) countActivity
FROM case where Id in : caseIds])
{
mapActivityHistoryCountToCase.put(caseObj.Id, caseObj.countActivity);
}
I am not able to use Count for the activity history. please suggest .
I tried it this way too. But of no use.
Map<Id, Integer> mapActivityHistoryCountToCase = new Map<Id, Integer>(
[SELECT count(SELECT ID FROM ActivityHistories)
FROM case where Id in : caseIds);