Hi there
I want new tasks to be on the bottom of the backlog. Now I have the issue that in JIRA 7.1.6 the RankService does not seem to be available anymore and I can not find what is wrong.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.ComponentManager
import com.atlassian.plugin.PluginAccessor
import com.atlassian.jira.bc.project.ProjectService
import com.atlassian.greenhopper.service.rank.RankCustomFieldService
MutableIssue myIssue = (MutableIssue) event.issue;
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor();
Class rankServiceClass = pluginAccessor.getClassLoader().findClass("com.atlassian.greenhopper.service.rank.RankCustomFieldService");
def rankService = ComponentAccessor.getOSGiComponentInstanceOfType(rankServiceClass);
def rankField = rankService.getDefaultRankField();
def outcome = rankService.rankLast(user, rankField.getIdAsLong(), myIssue);
if (outcome.isValid())
println "Re-ranked";
else
println "Error: " + outcome.getErrorCollection().getErrorMessages();
import com.atlassian.greenhopper.service.rank.RankCustomFieldService can not be found
Hopefully someone can help me.
Best regards
Benjamin
Hi Benjamin,
You need something like
//your imports
@WithPlugin("com.pyxis.greenhopper.jira")
def rankService = PluginModuleCompilationCustomiser.getGreenHopperBean(RankService)
//your code....please let me know if you need further assistance
regards
Thanos
@Thanos Batagiannis [Adaptavist], what is the fully qualified classname of this class :
PluginModuleCompilationCustomiser
that I need to import?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.