Hi
So, I have created a scripted custom field called "in progress date" which capture the last date the issue was "in progress" status but wipe that field when the status change to any other state other than "in progress" and I could do that successfully using the below code :
package com.onresolve.jira.groovy.test.scriptfields.scripts
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
import org.apache.log4j.Level
def logg = Logger.getLogger("")
logg.setLevel(Level.DEBUG)
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def createdTime = ''
def createdtime = ''
def created = changeHistoryManager.getChangeItemsForField(issue, "status").reverse().findResult{
it.toString == "In Progress" || it.toString == "In Development" ? createdTime = it.getCreated().getTime() : "no date for in progress status" }
//logg.debug( created )
//logg.debug( createdTime )
createdTime ? new Date(createdTime) : null
but now I need the date to not be wiped when the status is changed from in progress to Done in addition to the other condition which is (wipe that field when the status change to any other state other than "in progress")
meaning that wipe the last "in progress date" when the status change to any other state other than "in progress" except when the status changes from in progress to Done
So how Can I achieve that ?
Update : I have figured out a way and it is in the first comment