Skip to main content
Jon Chapman 님이 #Data Management에 질문했습니다
 and Hi there. It seems like there has been previosu activity on this, but I couldn't find a resolution. I want to count the number of EVENT's (ie: appointments) based on criteria relating the EVENT's related CONTACT (eg: lead source), and then apply counts to the data again using CONTACT fields (eg: count # events where lead source = Google and state = X). The events and contacts don't work nicely as 'Entity 'Event' is not supported for semi join inner selects'
답변 7개
  1. 2016년 12월 2일 오전 6:46
    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?

     

     
0/9000