How to increase / update the custom problem value in JIRA based on its previous value?

Hi, I have a lot of automatic releases and comments on JIRA. And I wanted to add to the problem customField with the name "Number of automatic updates", which increases every time problems are commented. A typical solution for this is to use the number of comments, but this is not possible, since comments are programmatically limited to 20. Thus, in this case, I would always have a maximum of 20.

Is there an easy way to do this?

I try to use this approach, but it continues to give me exceptions and errors related to the CustomField object:

MutableIssue issue = IM.getIssueObject(alreadyReportedIssueId);
private static final String COMMENTNUMBER_CUSTOMFIELD_ID = "commentnumber-customfield-id";
private static final CustomField customFieldObject = CustomFieldManager.getCustomFieldObjectByName(COMMENTNUMBER_CUSTOMFIELD_ID);
issue.setCustomFieldValue(COMMENTNUMBER_CUSTOMFIELD_ID, (Integer.parseInt(customFieldObject.getValue(issue))++));

PS: The JIRA version I'm using is: version 3.13.5

+4
source share

Source: https://habr.com/ru/post/1609824/


All Articles