Displaying how often the issue resumes in JIRA

I am currently running pretty prebuilt JIRA installations that are live and in use.

I am now at the point where I would like to create a custom field in each error that will display the total number of times and the issue / error will be reopened.

There is a plugin ( https://answers.atlassian.com/questions/19665/how-to-count-based-on-status-jira ) that does something similar, however I am looking for a solution that does not require buying a third party plugin (OPS doesn't like plugins).

I've searched forums high and low and couldn't even find a good starting point. Your help is always appreciated. Thanks in advance!

EDIT: Current JIRA version: 5.2

+3


source to share


3 answers


Create a custom field to count the time the issue was opened and set the default value. Then use the Behavior Plugin to add the script validation to the transitions you want to count. In your validation script add a custom field and return true. there should be something like:

FormField formComponent = getFieldById(fieldChanged)
FormField formUserField = getFieldByName("UserFieldA"
formUserField.setFormValue(Integer.valueOf(formUserField.getFormValue()) + 1)

      

If you have any problems with coding take a look here or ask here.



An easier way is to attack the post function to reopen the transition using Jira Scripting Suite and use it to increase the margin, but it doesn't support Jira 5.2 yet.

If you don't want to use any plugins, you can use Webhooks by reopening the workflow, which will be published to the URL, which in turn will connect back using the REST API and increment this field.

+3


source


A Custom field contains some information (metric, counter, difference information, etc.), but this is not logic by itself. So the problem is that in order to make a (custom) field larger, you will need to do some logic. So, you are left with three options:

  • Use the plugin you are talking about
  • Custom-build plugin for this
  • Use a built-in external application using a REST API that polls for changes in issues and detects "reopens" and increments custom field values.
  • Manually assign this field (not really an option)


So, in the end, there aren't many options that don't require resouces - developing or buying some plugin. It is usually best to buy a plugin because you buy support with that as well. However, be careful if the plugin is not developed by Atlassian, there is a possibility that it may not support future versions of JIRA, or it may not be compatible immediately after a new version of JIRA is released.

0


source


My solution is to add a post function to the "Reopen" transition with the following code (assuming you have the Script Runner plugin installed and enabled, also add the "Reopen count" custom field to the corresponding viewport):

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue

def componentManager = ComponentManager.getInstance()
def customFieldManager = componentManager.getCustomFieldManager() 
def reopenCount = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Reopen count'}
def changeHolder = new DefaultIssueChangeHolder();
def reopenCountValue = issue.getCustomFieldValue(reopenCount)
if(reopenCountValue == null) reopenCountValue = 0.0d
reopenCount.updateValue(
    null, 
    issue, 
    new ModifiedValue(
        reopenCountValue, 
        ++reopenCountValue
    ), 
    changeHolder
);

      

0


source







All Articles