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 }
Thanks a lot !!!
It looks like you're new here. Sign in or register to get started.