5

Hello I have a lot of automatic issue creation and commenting in JIRA. And wanted to add to the issue a customField named "Number of automatic updates" that increments everytime an issues is commented. The tipical solution for this is using the number of comments but that is not possible in because the comments are limited programatically to 20. So in this case I would always have at max 20.

Is there any straightforward method that makes it possible to do so?

I'm trying this approach but it keeps giving me exception 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 version of JIRA I'm using is: version 3.13.5

CMPSoares
  • 4,175
  • 3
  • 24
  • 42
  • What about listening for ISSUE_COMMENTED_ID event and update custom field value there? Or using ChangeHistoryManager to get count of change items. – Robert Nov 13 '15 at 12:45
  • Hello @Robert the problem here is the version that's being used. Hard to work with deprecated API's, but an upgrade is coming soon, so I hope that'll make it easier. :-) – CMPSoares Nov 21 '15 at 17:04

1 Answers1

0

This seems trivial with the Jira REST API?

https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/updating-an-issue-via-the-jira-rest-apis

Somaiah Kumbera
  • 7,063
  • 4
  • 43
  • 44