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

2
  • 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, 2015 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, 2015 at 17:04

1 Answer 1

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

3
  • Not when using the version I'm talking about in the question... :-p
    – CMPSoares
    Nov 16, 2015 at 9:11
  • Uff sorry. Didnt realize that version didnt support the rest api Nov 16, 2015 at 9:37
  • That version is all RMI based. Isn't as intuitive as REST.
    – CMPSoares
    Nov 16, 2015 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.