How do i change status of issue?

gri deniz August 15, 2011

Hi, i am developing jira plugin for web interface but i can not find anything about issue status. For example i try to put a button in my issues for start/stop progress. What should i do? Is JQL good idea? If it is what should my query be?

4 answers

1 accepted

14 votes
Answer accepted
Igor Sereda [ALM Works]
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.
August 15, 2011

JIRA does not allow arbitrary change of the issue status - Issue must go through a workflow transition.

You can use WorkflowManager.getWorkflow(Issue) to find out which workflow does the issue belong to. Then you can use workflow.getLinkedStep(issue.getStatus()) to get the current workflow step the issue has. Then you can use StepDescriptor.getActions() to see which transitions are available and select the required ActionDescriptor. Then you can use IssueService.validateTransition() and IssueService.transition() to transition the issue.

Eva
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.
August 15, 2011

As I have asked in the other post, how would you transition a ticket base off the status of another ticket, assuming both ticket uses the same workflow? Like if TEST-123 is in "Development", I want to move "HOT-2223" to "Development" if it's not already in "Development". From your answer and other old JIRA forum posts, I just dont know how you can move HOT-2223 base of list of transitions. I dont want to hot code the transition, as it mentioned in this forum, but yet I just dont know how you would move forward when you have 6 transitions in that given step. Thoughts?

gri deniz August 18, 2011

But all method you mentioned is about getting informations of statue of issues. I want to change statue. For example if status is "open" and when i click the button, status changes "in progress".If it is possible on java script,if it is,it is best for me but rest of solutions are posibble too.

Like Marilyne Picques likes this
0 votes
Supratim Bhaumik April 26, 2019

Can you please help me for WorkflowManager which maven

dependency I will use.

Nhac Tat Nguyen June 26, 2019

Here you are:

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
Lokesh Nerella September 24, 2019

How to associate our repo to the ComponentAccessor class so that I will update t

Nhac Tat Nguyen September 24, 2019

Hi @Lokesh Nerella 

ComponentAccessor class comes along with jira-api dependency, all you need to do is make sure that you have that dependency, and then you will be able to use that class.

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
0 votes
Ray Ortega June 4, 2018

I don't think none of you had understood the original quest. 

 

When someone ask how to do it, you either show them the step on how to do it or forever hold your peace. Do not try to look or pretend to be smart with unnecessary comments. Just answer the question being asked. if you don't know how to explain to other how to do it just keep your comments for yourself.

I don't know the answer to that question, I was hopping someone will take the time and show steps by steps procedures on how to do it.

 

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.
June 4, 2018

I think the question was understood perfectly, and it looks like Igor's answer is correct to me, as you should change status by moving through the workflow.

That is still the right answer, 7 years later.

0 votes
grundic
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.
August 15, 2011

Pseudocode for jira 4.4:

ComponentAccessor.getIssueManager().getIssueObject("TST-1000").setStatus(status);

For previous versions try using

ManagerFactory.getIssueManager().getIssueObject("TST-1000").setStatus(status);

Igor Sereda [ALM Works]
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.
August 15, 2011

This will not work - you will only change the status field in the Issue bean.

gri deniz August 18, 2011

what are the text os script, we can write just "in progress" or "open" just, can you give me an example?

Dieter
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.
March 27, 2012
PLEASE don't do it that way even though maybe at the first glance this might do what you need. Igor has given the reasons. just commented this again since i saw an answer referencing to this
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.
March 27, 2012

I just read what I think Dieter just read too. Igor's answer is correct - Gri does not seem to have spotted the point in the last sentence about actually performing the transition.

Suggest an answer

Log in or Sign up to answer