We will cover all that you need to know in order to calculate the cycle time of a deal.
You will need the following fields:
- Start Date, Field Type: Date. There is an out-of-the-box field called 'Created' that you can use for this purpose.
- Closed Date, Field Type: Date.
You can use the names that best suit your organization for these fields. You will just need to replace their names in the code snippet below.
If you want to learn how to create Fields, please visit the following tutorial:
Fields
Give a meaningful name to your field and enter a description, although optional is recommended to let your users know that this field is a calculated one. The field type should be set to 'Number' and the 'Calculated' box enabled in order to display the calculation section. Then copy & paste the code below:
(function(deal){
var StartDate = Date.parse(deal.created);
var EndDate = Date.parse(deal.closeDate);
if(!EndDate){
return 0;
}
var timeBetween = EndDate - StartDate;
var days = timeBetween / (24 * 60 * 60 * 1000);
var justDays = parseInt(days);
return justDays;
}(deal));