Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set issue status?

Alexander Urzhumtsev April 23, 2013

I create issue so

IssueInputBuilder issueBuilder = new IssueInputBuilder(
				nameOutputProject, currentIssue.getIssueType().getId(),
				currentIssue.getSummary());
		issueBuilder.setDescription(currentIssue.getDescription());
		issueBuilder.setAssignee(currentIssue.getAssignee());
		issueBuilder.setPriority(currentIssue.getPriority());
		issueBuilder.setProjectKey(nameOutputProject);
IssueInput issueInput = issueBuilder.build();

but IssueInputBuilder don't have method setStatus(). How to set issue status?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2013

You don't set the status of an issue in most cases.

If you're adding a new issue, you can (importing issues does this), but for existing issues, you should move the issue through the workflow, not set the status. Status is an indicator of where an issue is in the workflow, not a real "field".

Alexander Urzhumtsev April 23, 2013

I understood idea, but how to move the issue through the workflow programmatically?

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

use issueService.trannsition after issueService.validateTransition. You will find examples for these methods in Answers itself.

Alexander Urzhumtsev April 24, 2013

I find code

JiraWorkflow workFlow = ComponentAccessor
							.getWorkflowManager().getWorkflow(currentIssue);
					Status status = currentIssue.getStatusObject();
					com.opensymphony.workflow.loader.StepDescriptor currentStep = workFlow
							.getLinkedStep(status);
					List<ActionDescriptor> actions = currentStep.getActions();
					int actionId = 0;
					for (ActionDescriptor actionDescriptor : actions) {
						if (actionDescriptor.getName().equals("Start Progress")) {
							actionId = actionDescriptor.getId();
						}
					}
					IssueService issueService = ComponentAccessor
							.getIssueService();
					TransitionValidationResult transitionValidationResult = issueService
							.validateTransition(getLoggedInUser(),
									currentIssueId, actionId, issueService.newIssueInputParameters());
					if (transitionValidationResult.isValid()) {
						IssueResult transitionResult = issueService.transition(
								getLoggedInUser(), transitionValidationResult);
						if (!transitionResult.isValid()) {
							// Do something
						}
					}

0 votes
Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

Hello Alexander,

how said Nic, you cant set the Status, but you have to "do transition" in your workflow. In JSON si something like this:

{
  "transition": {
      "id": "5"
  }
}

So you have to put transition ID, to set Status field(for example REST API, but it's only example, because you are not using it: http://docs.atlassian.com/jira/REST/latest/#id109333).

Alexander Urzhumtsev April 23, 2013

Do you know how to do transition when use jira rest java client library?

Michal Husar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

You can look at this: https://ecosystem.atlassian.net/browse/JRJC-76 . I think Transition or TransitionInput can do this magic(I'm using REST API not REST Client, so I don't know exactly how to do this).

TAGS
AUG Leaders

Atlassian Community Events