Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to check custom field history for more than two issues, with the help of Scriptrunner

I have one custom field named "Data", and the values are acb1, abc2, and abc3. This field is editable on the Edit screen.

Requriment- I want to check how many issues(issue count- more than 100) have been moved from abc1 to acb2 or abc3, and how many issues have moved from abc2 to abc3 from 1st June to the current date. With the help of Scriptrunner.

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 21, 2023 • edited

Hi @Durgesh Masurkar

For your requirement you can try something like this:-

import com.adaptavist.hapi.jira.projects.Projects
import com.atlassian.jira.component.ComponentAccessor

def changeHistoryManager = ComponentAccessor.changeHistoryManager
def issueManager = ComponentAccessor.issueManager
def project = Projects.getByKey('MOCK')
def issues = issueManager.getIssueObjects(issueManager.getIssueIdsForProject(
def mailTypeName = 'Mail Type'
def resultMap = [:] as Map<String,Long>

issues.each {
def changeHistories = changeHistoryManager.getChangeHistories(it)
def changeOptions = []

changeHistories.collect { changeHistory ->
def result = changeHistory.changeItemBeans.find {
it.field == mailTypeName
if (result && result['toString']) {
changeOptions << result['toString'].toString()
if (changeOptions.size() >= 3) {
resultMap.put(it.key, changeOptions.size() as Long)

log.warn "=======>>>Total issue changed: ${resultMap.size()}"

Please note the sample working code above is not 100% exact to your environment. Hence, you will need to modify it accordingly.

Below is a screenshot of the configuration:-


I hope this helps to solve your question. :-)

Thank you and Kind regards,


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events