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

How can I set an issues status to 'Resolved'?

Scott Lavender June 24, 2012

I'm working with Jirret Python script to integrate Gerrit code reviews into our Jira workflow. I can apply a comment to the Jira issue, which is the defauilt behavior of Jirret. What I need is for the issues status to be moved to 'Resolved' as well. I cannot find complete examples of the propper use of progressWorkflowAction(). Here is a snippet from the original Jirret code, with my partial attempt included commented out.

for i in issues:
            print 'Updating issue: ' + i
            rpc.jira1.addComment(auth, i, message)
#            if status == 'merged':
#                print 'Moving issue to Resolved: ' + i
#                rpc.jira1.progressWorkflowAction(auth, i, 'Resolved', [{}])
            if len(status) > 0 and len(custom_field) > 0:
                rpc.jira1.updateIssue(auth, i, {'customfield_' + custom_field: [status]})

Can anyone help?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
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.
June 24, 2012

If you don't have resolution on the workflow screen, you need to set the resolution separately on the issue object and store it.

Else, you can do something like this:

RemoteFieldValue[] actionParams = new RemoteFieldValue[] {
                new RemoteFieldValue("resolution", new String[] { "5" })
};
RemoteIssue remoteIssue = getJiraSoapService().progressWorkflowAction(getToken(), issueKey, "5", actionParams);

The snippet is in Java ;)

Scott Lavender June 24, 2012

I know that there are two things, status and resolution. When a developer submits the code in Gerrit, it is merged. I want the status in Jira to be changed to 'Resolved'. If the change passes QA, then they set it to 'Closed'.

So yes, I may need to set the resulution, but how do I set the status? I guess what you are saying is that I need to set both?

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.
June 24, 2012

You need to do both, yes. If you have resolution on screen, you can do both using a single step as shown above. if not, it will be 2 calls, onle to change status and another to update issue with resolution.

Scott Lavender June 24, 2012

Ok, then can you explain the first one? What is issueKey, and where does the value of "5" come from?

Thanks for the help!

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.
June 24, 2012

issue key is the issue key of the issue you are trying to progress in the workflow! "TEST-1" for example.

"5" is the id of the resolution you are trying to set. You can get from database or find it in the browser url while editing the resolution on UI!

Scott Lavender June 24, 2012

So, then it is possible that this would work in my scenario:

...
rpc.jira1.progressWorkflowAction(auth, i, "5", {'resolution': "5"})
...

Where i = "MYISSUE-21", for example, whould set MYISSUE-21 to resolved and fixed?

Scott Lavender June 24, 2012

Ah, OK! So, in my case status is 'Resolved' = "5", and resolution is 'Fixed' = "1". So it would be:

rpc.jira1.progressWorkflowAction(auth, i, "5", {'resolution': "1"})

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.
June 24, 2012

Oh wait, there are 2 '5's. One is the actionId which is id of the transition in the workflow. And the last parameter should be an aray of RemoteFieldValue. I don't know python syntax.

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.
June 24, 2012

It is not the status id. It is the transition id. If you go to the workflow steps, you will find an id for each transition.

Scott Lavender June 24, 2012

When I view a resolved/fixed issue in XML, the value of status is "5" and resolution is "1". So, my thinking now is below:

rpc.jira1.progressWorkflowAction(auth, i, {'status': "5"}, {'resolution': "1"})

Do you agree?

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.
June 24, 2012

value of status is "5"

What is the value of transition? Status is not transition.

Scott Lavender June 24, 2012
<item>
<title>[RELEASE-5] Move Debian files for Network</title>
<link>http://jira.swenglab.internap.com/browse/RELEASE-5</link>
<project id="10400" key="RELEASE">Cloud Release</project>
<description/>
<environment/>
<key id="11156">RELEASE-5</key>
<summary>Move Debian files for Network</summary>
<type id="8" iconUrl="http://jira.swenglab.internap.com/images/icons/ico_task.png">Technical task</type>
<parent id="11152">RELEASE-1</parent>
<priority id="1" iconUrl="http://jira.swenglab.internap.com/images/icons/priority_blocker.gif">Blocker</priority>
<status id="5" iconUrl="http://jira.swenglab.internap.com/images/icons/status_resolved.gif">Resolved</status>
<resolution id="1">Fixed</resolution>
<assignee username="slavender">Scott Lavender</assignee>
<reporter username="slavender">Scott Lavender</reporter>
<labels></labels>
<created>Tue, 12 Jun 2012 09:27:15 -0400</created>
<updated>Wed, 20 Jun 2012 15:23:52 -0400</updated>
<resolved>Thu, 14 Jun 2012 08:29:57 -0400</resolved>
<version>Q3-Dirt</version>
<fixVersion>Q3-Dirt</fixVersion>
<due/>
<votes>0</votes>
<watches>0</watches>
<timeoriginalestimate seconds="0">0 minutes</timeoriginalestimate>
<timeestimate seconds="0">0 minutes</timeestimate>
<timespent seconds="3600">1 hour</timespent>
<attachments></attachments>
<subtasks></subtasks>

Scott Lavender June 24, 2012

There is no <action>. Am I missing something?

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.
June 24, 2012

In the wokflow XML, it will be action id.

&lt;action id="2" name="Close Issue" view="resolveissue"&gt;

Scott Lavender June 24, 2012

There is no field transition...

Scott Lavender June 24, 2012

Ok found it:

&lt;action id="5" name="Resolve Issue" view="resolveissue"&gt;

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.
June 24, 2012

Ah, "5" again! That's the one.

Scott Lavender June 24, 2012

OK, this is not posible with rpc-xml, only when using soap. Thanks for the help...

TAGS
AUG Leaders

Atlassian Community Events