I need to calculate and display in a dashboard gadget the average time between two custom date fields.
More specifically, in the project, I want to know the average time (in days) between 'Customer Request Date' and 'Customer Proposal Date'.
Create scriptrunner scripted field and use the below code on ocnifguration
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.Issue; import java.util.Date.* def customFieldManager = ComponentAccessor.getCustomFieldManager(); def dateFieldObject= customFieldManager.getCustomFieldObject('customfield_id1'); def dateFieldObject2= customFieldManager.getCustomFieldObject('customfield_id2'); if(issue.getCustomFieldValue(dateFieldObject) && issue.getCustomFieldValue(dateFieldObject2)) { def dateValue= issue.getCustomFieldValue(dateFieldObject) as Date def dateValue2= issue.getCustomFieldValue(dateFieldObject2) as Date return dateValue - dateValue2 }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.