You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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(project.id))
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,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.