Updating an issue
In this recipe, let's look at editing an existing issue.
How to do it...
Let's assume that we have an existing issue object. We will just modify the Summary
to a new summary. Following are the steps to do the same:
Create the
IssueInputParameters
object with the input fields that need to be modified:IssueInputParameters issueInputParameters = new IssueInputParametersImpl();issueInputParameters.setSummary("Modified Summary");
In JIRA 4.1.x version, there is a bug, because of which we need to populate
IssueInputParameters
with all the current fields on the issue along with the modified field to make sure the existing values are not lost in an update. However, it is resolved in JIRA 4.2+ and hence the previous code is enough to modify the summary alone.Still, if you do not want to retain the existing values and just want the summary on the issue to be updated, you can set the
retainExistingValuesWhenParameterNotProvided
flag as shown:issueInputParameters.setRetainExistingValuesWhenParameterNotProvided...