I have a transition timestamp field (Medical Record Requested) that captures the date of a specific transition. I would like script runner to help me enable another field to display date of the transition field + 10 days. I have created a scripted field using script runner but it is displaying an error.
Below is the script:
import com.atlassian.jira.component.ComponentAccessor
final String customField = "Medical Record Requested"
def startDate = Calendar.instance
def endDate = Calendar.instance
def changeHistoryManager = ComponentAccessor.changeHistoryManager
def transition = changeHistoryManager.getChangeItemsForField(issue, customField)
startDate.setTime(transition*.created.max())
int weekDays = 10
while (startDate.timeInMillis < endDate.timeInMillis) {
startDate.add(Calendar.DAY_OF_MONTH, 1)
startDate.get(Calendar.DAY_OF_WEEK) in [Calendar.SATURDAY, Calendar.SUNDAY] ? null : ++weekDays
}
weekDays
Below is the error am getting after I execute the targeted transition:
$dateFormatterWithoutTime.format($value)
Please I would need some help