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
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.