Hi All,
hence I am not acquinted in Groovy could you please help me? We would like to have a custom field which displays the number of reopening an issue. So by default the value will be 0 for each issue and each time the issue has been reopened from Resolved to Reopen than the value will increment by 1.
We don't have MISC workflow plugin nor JJUPIN. We only have Behaviour and Script Runner. Could you please help us?
The workflow post function method is not working for us because we need that values retrospectively.
Thanks in advance,
Rumi
import com.atlassian.jira.ComponentManager def componentManager = ComponentManager.getInstance() def changeHistoryManager = componentManager.getChangeHistoryManager() Double counter=0 changeHistoryManager.getChangeItemsForField(issue, "status").each{ if (it.toString=="Reopened") { counter=counter+1 } } return counter
You need to create new custom field of type Scripted Field and add upper code to it (from jira administration, Add-ons, Scriptrunner Script fields).
Field has parameters:
- Template: Number field
- Configured searcher: Number Searcher
Please check your status name after reopening issue and change it in script to proper value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vidic,
it was very helpful for me, thanks!
any chance is not working for status I created in Jira? I tried to this with the status "Reopened By Customer" and it didn't work. any idea why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.