Hi,
I need to display how often an issue has seen a a specific status. For example "How often hade the current issue been on the 'in Progress' status."
Alternatively, the count of a specific transition would give me the same result.
Unfortunately I have no idea how to do this. Can someone help me please?
Thank you
Mark
Community moderators have prevented the ability to post new answers.
You have to search through the change items
changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue)
of the issue to count the changes to the status.
changeItems?.findAll{it.field == 'status' && it.getTos().values().contains('In Progress')}.size()
Hi Henning,
I added a Script Runner / script field:
changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue)
return changeItems?.findAll{it.field == 'status' && it.getTos().values().contains('In Progress')}.size()
But it seems not to work for me. Tried many variations but seems like I can't get it to work :-(
However, thanks Henning for the intial help :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need the imports and stuff:
import com.atlassian.jira.component.ComponentAccessor def changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue) return changeItems?.findAll{it.field == 'status' && it.getTos().values().contains('In Progress')}.size()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually I tried this:
import com.atlassian.jira.component.ComponentAccessor def changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue) return changeItems?.findAll{it.field == 'status' && it.getTos().values().contains('Not fixed')}.size()
I set the template type to Number and nothing happens when I test it with an issue. Do I get somewhere a log about what goes wrong when I preview a script with a sample issue? This might be able to help me debugging it.
Thank you very much
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you use the number template you have to return a Double. Could you try to add a as Double to the last line?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried
import com.atlassian.jira.component.ComponentAccessor def changeItems = ComponentAccessor.changeHistoryManager.getAllChangeItems(issue) return changeItems?.findAll{it.field == 'status' && it.getTos().values().contains('Not fixed')}.size() as Double
but no change. Without any kind of logfile its quite hard to find a place to fix something.
Thanks anyway!
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can print some logging info to the catalina.out file using log.error(). So
log.error changeItems
before the return statement should show you if you get what you expect.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.