2
我想測量花費的時間代表打開一個新的領先,但無法弄清楚如何運行使用日期/時間戳的時間部分的鉛歷史對象的報表數量。我可以看到我做一個簡單的「顯示引導歷史」的時間,但無法弄清楚如何針對該領域運行報告。如何在Salesforce中執行主數據歷史記錄報告?
感謝
湯姆
我想測量花費的時間代表打開一個新的領先,但無法弄清楚如何運行使用日期/時間戳的時間部分的鉛歷史對象的報表數量。我可以看到我做一個簡單的「顯示引導歷史」的時間,但無法弄清楚如何針對該領域運行報告。如何在Salesforce中執行主數據歷史記錄報告?
感謝
湯姆
我不認爲你可以很容易地在此報告:/我喜歡,雖然被證明是錯誤的。
當你只有一把錘子時,一切都看起來像釘子,呃?
您可以在報告中獲得開幕日,但不是真正的「開放和領導創造之間的秒數」。我已經檢查過,看起來你甚至不能通過創建一個工作流程來打開鉛標記。
如果你罰款出口類似的報告的細節,Excel和構建公式有我建議路線。如果Salesforce真的必須達到100% - 您是否曾經使用過Apex和Visualforce?你可以在Leads上寫一個觸發器來檢測lead的打開並將時間差寫入一些自定義字段。
或者您可以創建一個VF頁面,其中類似於此的代碼將成爲數據源。 對於我的數據則輸出
平均花費160917287秒爲用戶005 ...開2個 線索。
(我知道這是一個很大的數字,他們從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.');
}