Hello everyone!
How its possible in Jira 8 get and modify issue Rank?
I found old solution https://community.atlassian.com/t5/Jira-questions/Using-the-GreenHopper-API-to-modify-rank/qaq-p/245912
but seems it is no longer actual.
Any ideas how to use Rank service in scriptrunner?
I find how to get Rank, but if i wanna to change rank of issue (like JIRA-1 is now RankHigher than JIRA-2)
import com.atlassian.jira.component.ComponentAccessor
def admin = ComponentAccessor.getUserManager().getUserByKey('admin')
def issueManager = ComponentAccessor.getIssueManager()
def issue1 = issueManager.getIssueByCurrentKey("JIRA-1")
def issue2 = issueManager.getIssueByCurrentKey("JIRA-2")
def rank = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10700)
issue.getCustomFieldValue(rank)
def rank_value1 = issue1.getCustomFieldValue(rank).toString()
def rank_value2 = issue2.getCustomFieldValue(rank).toString()
Regards
Hello. If I'm not mistaken JiraAgile plugin ranks the issues, so you need use its classes and in particular com.atlassian.greenhopper.api.rank.RankService. Try this to make rank of issue1 after issue2:
import com.atlassian.greenhopper.api.rank.RankService
import com.atlassian.jira.issue.fields.CustomField
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import com.atlassian.jira.component.ComponentAccessor
@WithPlugin('com.pyxis.greenhopper.jira')
@JiraAgileBean
RankService rankService
def user = ComponentAccessor.getUserManager().getUserByKey('userName')
def issue1 = ComponentAccessor.getIssueManager().getIssueByCurrentKey("KEY")
def issue2 = ComponentAccessor.getIssueManager().getIssueByCurrentKey("KEY")
def rank = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(rankFieldId)
rankService.rankAfter(user, rankFieldId, issue1, issue2)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import com.atlassian.greenhopper.api.rank.RankService
doesn't work for me.
"Unable to resolve class "com.atlassian.greenhopper.api.rank.RankService"
Does anyone have any suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.