Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can the Greenhopper rank by manipulated in scripts via an API?

Rick Trudeau
Contributor
January 11, 2012

We have Jira 4.3.4 running GreenHopper 5.6.8. We are using the GH Rank property to assign ranks to the issues in our sytem.

In our setup, I would like to be able to modify the GreenHopper Rank of an issue based on the rank value that is assigned to a different issue.

For example, as a side effect of changing the Rank on Issue#1 to 100, I would like to have Issue#2's rank changed to 101.

I have been looking through the API and have found a way to read the GH Rank using the Groovy script getCustomField function.

What I see in the returned rank value is not the absolute value of the Rank as seen in the GUI, but some very large number. I don't want to attempt to set the rank value because I'm not sure what relative value should be used.

So, my questions are:

1) Does anyone know how to translate the rank DB value to the value seen in the GUI?

2) Is there a better API for retrieving the Rank value?

3) Is there an API that allows us to modify the Rank value?

3 answers

1 accepted

0 votes
Answer accepted
sclowes
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.
January 13, 2013

You can indeed ust the REST API internally to a JIRA plugin to do this but the more direct route is via the RankService. I posted some sample code for this in this answer.

Thanks,
Shaun

0 votes
Renjith Pillai
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.
January 11, 2013

You can use the REST api of GH to do this. Read https://answers.atlassian.com/questions/45323/rest-api-for-ranking

If you are developing a JIRA plugin, you will have to invoke the rest method from a javascript to do it.

0 votes
Pedro Cora
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2013

You may want to take a look at http://developers.atlassian.com where you'll find development guides that will help you on these scripts.

Cheers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events