It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to resolve issue programmatically?

Man Manson Jul 25, 2012

When i set issue staus as resolved like that

issue.setStatusObject(resolvedStatus);
issue.setResolutionObject(resolution);

The status seems to be updated, but the resolve issue button at the issue page is still active. What should i do?

Thanks, in advance.

2 answers

1 accepted

3 votes
Answer accepted
Jobin Kuruvilla [Go2Group] Community Leader Jul 25, 2012

Use IssueService. First execute validateTransition and then transition methods.

http://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/issue/IssueService.html

Man Manson Jul 25, 2012

Tell me please, how can i obtain a actionId for this method?

Jobin Kuruvilla [Go2Group] Community Leader Jul 25, 2012

You can see the actionId in the workflow XML. If you want to get it programmatially, do something like this:

JiraWorkflow workFlow = componentManager.getWorkflowManager().
       getWorkflow(issue);
GenericValue status = issue.getStatusObject().getGenericValue();
       com.opensymphony.workflow.loader.StepDescriptor currentStep =
       workFlow.getLinkedStep(status);
List<ActionDescriptor> actions = currentStep.getActions();

And then iterate over actions and find the one to use.

Reference: p.121 JIRA Development Cookbook

1 vote
Nic Brough [Adaptavist] Community Leader Jul 25, 2012

I think you're mixing up resolution, status and transitions.

Resolution is a flag saying how something was resolved. You can set that on-screen, via a workflow post function, or in code (exactly the method you have used). You have nothing wrong there.

However, the "resolve issue" button is a transition, which moves an issue through the workflow, from one status to another. It is NOT as simple as just setting a status, and you've broken your issue with your code. You might well be seeing the "correct" status on the issue, but you haven't moved it through the workflow, so it's now got the wrong status for the step it is on.

What you should do is:

  1. Remove or stop using the code you've written as it's breaking anything it touches.
  2. Run the integrity checker to repair any issues you have broken.
  3. Rewrite your code so that it moves things through the workflow, rather than just forcing a status in.

Edit - Jobin's post is the detail on step 3 of what I just scribbled...

Man Manson Jul 25, 2012

Can you provide a code snippet, please?

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Statuspage

⭐️Would you recommend Statuspage? Leave a (honest!) review. ⭐️

Hi Community friends, We're working on sourcing more reviews on Capterra – a popular software review site –  to help teams like yours make more informed decisions when choosing an inc...

82 views 3 5
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you