
답변 7개
Hi Jon,
To answer your question, need to know if you are ok counting the number of events outside the soql?
If yes, then here is the way to go:Soql like this:
select (select WhoId from Events) from contact where leadsource = 'web'
Now we can count the number of events in the resulted list in apex like this:
List<contact> c_lst = new List<contact>([select (select WhoId from Events) from contact where leadsource = 'web']);
Map<Id,integer>abc = new Map<Id,integer>();
for (contact c : c_lst) {
abc.put(c.id,c.events.size());
}
system.debug('abc = '+abc);
Does this answer your question?