Hi team,
I need a scripted field to calculate the days from Due date - Reported date(Custom field).
I have a script which calculates todays date - Reported date(script is given below).
Can you please help me in modifying the script to get the exact request.
Script:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def createdDateValue = issue.getCreated()
def resolutionDate = issue.getResolutionDate()
def issueReportedDate = customFieldManager.getCustomFieldObject("customfield_17705")
def issueReportedDateValue = issue.getCustomFieldValue(issueReportedDate)
if (issueReportedDateValue != null) {
if (resolutionDate != null) {
def daysDiff = resolutionDate - issueReportedDateValue
return daysDiff
}
else {
def daysDiff = new Date() - issueReportedDateValue
return daysDiff
}
}
return null
I didn;t tried it but made some small adjustments which should help:
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def dueDateValue = issue.getDueDate()
def issueReportedDate = customFieldManager.getCustomFieldObject("customfield_17705")
def issueReportedDateValue = issue.getCustomFieldValue(issueReportedDate)
if (issueReportedDateValue != null && dueDateValue != null) {
def daysDiff = dueDateValue - issueReportedDateValue
return daysDiff
}
return null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.