2012-11-19 3 views
2

담당자가 새 리드를 여는 데 걸리는 시간을 측정하고 싶지만 리드 이력 개체의 날짜/시간 스탬프의 시간 구성 요소를 사용하여 보고서를 실행하는 방법을 파악할 수 없습니다. 간단한 "쇼 리드 내역"을했지만 그 필드에 대해 보고서를 실행하는 방법을 알 수없는 때를 볼 수 있습니다. 톰은 당신이 쉽게보고 할 수 있다고 생각하지 않습니다Salesforce에서 리드 내역보고를 수행하는 방법은 무엇입니까?

답변

0

감사

:/내가 사랑하는 것은 잘못 생각 입증한다.

망치가있을 때 모든 것이 못처럼 보입니다.

보고서에서 시작일을 알 수 있지만 실제로는 "개시와 리드 생성 사이의 초"가 아닙니다. 내가 확인한 바에 따르면, 리드를 열 때 발생하는 워크 플로를 생성하여 속일 수는없는 것처럼 보입니다.


당신은 엑셀과 유사한 보고서의 세부 사항을 수출하고 거기에 내가 그 길을 권하고 싶습니다 수식을 구축 괜찮 경우

sample lead history report

. Salesforce에서 실제로 100 %가되어야하는 경우 - Apex 및 Visualforce를 사용해 본 적이 있습니까? 리드 열기를 감지하고 일부 맞춤 입력란에 시간차를 작성하는 리드에 트리거를 작성할 수 있습니다.

또는 이와 비슷한 코드가 데이터 소스 인 VF 페이지를 만들 수 있습니다. 내 데이터의 경우는

평균적으로는 2 개 리드를 엽니 다 ... 사용자 005에 1억6천91만7천2백87초했다 출력합니다.

(나는 거대한 숫자라는 것을 알고 있으며, 2007 년부터 알고 있습니다.)

Map<Id, Long> timeCounter = new Map<Id, Long>(); // Counter how much time has passed between lead creation and opening of the record for each lead owner 
Map<Id, Integer> leadCounter = new Map<Id, Integer>(); // counter how many were actually opened 

for(LeadHistory lh : [SELECT CreatedDate, OldValue, NewValue, Lead.Name, Lead.OwnerId, Lead.CreatedDate 
    FROM LeadHistory 
    WHERE Field = 'IsUnreadByOwner' AND Lead.isUnreadByOwner = false 
    ORDER BY Lead.OwnerId 
    LIMIT 1000]){ 

    Long timeInSeconds = (lh.CreatedDate.getTime() - lh.Lead.CreatedDate.getTime())/1000; 
    Long totalTimeCount = timeCounter.get(lh.Lead.OwnerId); 
    Integer totalLeadCount = leadCounter.get(lh.Lead.OwnerId); 
    if(totalTimeCount == null){ 
     totalTimeCount = timeInSeconds; 
     totalLeadCount = 1; 
    } else { 
     totalTimeCount += timeInSeconds; 
     totalLeadCount += 1; 
    } 
    timeCounter.put(lh.Lead.OwnerId, totalTimeCount); 
    leadCounter.put(lh.Lead.OwnerId, totalLeadCount); 
} 

for(Id userId : timeCounter.keyset()){ 
    Decimal avg = timeCounter.get(userId)/leadCounter.get(userId); 
    System.debug('On average it took ' + avg + ' seconds to for user ' + userId + ' to open ' + leadCounter.get(userId) + ' leads.'); 
} 
관련 문제