jira-client
jira-client copied to clipboard
could not set the status
Hi Bob, I started to try out your jira-client with a fresh Jira Core installation. I worked through your Quick Start Example and reading the issue, voting, add watchers and setting an assignee works fine. But I stuck with setting the status. I tried issue.transition() and issue.update() :
issue.transition().field(Field.STATUS, "In Progress").execute("Start Progress");
using jira-client 0.5: Field 'status' does not exist or read-only
using jira-client 0.6-SNAPSHOT: Failed to transition issue PROJ-1 400 Bad Request: {"errorMessages":[],"errors":{"status":"Field 'status' cannot be set. It is not on the appropriate screen, or unknown."}}
issue.update().field(Field.STATUS, "In Progress").execute();
using jira-client 0.5: Field 'status' does not exist or read-only
using jira-client 0.6-SNAPSHOT: Field 'status' does not exist or read-only
What I'm doing wrong? Setting the status using JIRA's web interface works without problems...
Thanks in advance Maik
I dig deeper into this STATUS thought...
What I found - in a nutshell - by reading http://stackoverflow.com/questions/30809831/update-jira-ticket-status-using-rest-api :
Status is not a field. So providingfield(Field.STATUS..) from jira-client may raise wrong expectations here.
Possibly states depends on current workflow and current status of the issue. So you have to find out possible states by
System.out.println("possible transitions:" );
List<Transition> transitions = issue.getTransitions();
for (Transition transition : transitions) {
System.out.println("Transition '"+transition.getId()+"'/'"+transition.getName()+"' would cause to state '"+transition.getToStatus()+"'");
}
choose from that results and set the new state by
issue.transition().execute([NEW_TRANSITION_ID]);
Bob, maybe you can add a status handling example to your 'Quick Start Example' ? Maybe this would help other people to become familiar more quickly with this topic.
Regards Maik
Thanks @mschuerer for the observation.
I can open a pull request with the status handing example that you are mentioning here. I agree that this will clear the confusion for some people.
Also, adding a jira-client level validation for preventing setting value of Field.STATUS and throwing an explicit exception with an actionable error message could also help. Let me try to incorporate that into a PR as well.
Thanks again for the suggestion.