This sample script field gets the date that an issue was first transitioned through a particular action.

If it undergoes the same transition multiple times, only the first date is shown.

This can be useful for support workflows where you want to track when the customer was first responded to.

package com.onresolve.jira.groovy.test.scriptfields.scripts

import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def created = changeHistoryManager.getChangeItemsForField(issue, "status").find {
    it.toString == "In Progress" (1)
}?.getCreated()

def createdTime = created?.getTime()

createdTime ? new Date(createdTime) : null
1 Change to the action name you are interested in

Template

Date Time Picker

Searcher

Date Time Range picker

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.