Forums

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

How to get Priority value using Priority name in jira?

Ramesh Lakshmanasamy June 14, 2018

I need to get Priority value using  Priority name.

3 answers

1 vote
Mark Markov
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 14, 2018

Hello @Ramesh Lakshmanasamy

You can get priority like this

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.priority.Priority

def constantsManager = ComponentAccessor.getConstantsManager()
Priority priority = constantsManager.getPriorities().find {it.name == "High"}
Ramesh Lakshmanasamy June 14, 2018

Thanks for your answer @Mark Markov.will let you know after try above solution.

Ramesh Lakshmanasamy June 14, 2018

@Mark Markov its not worked.

Mark Markov
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 15, 2018

This method for sure return Priority object, may be you need priority id?

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.priority.Priority

def constantsManager = ComponentAccessor.getConstantsManager()
Priority priority = constantsManager.getPriorities().find {it.name == "High"}
def id = priority.id

 

Ramesh Lakshmanasamy June 15, 2018

I got solution Using PriorityManager class but i implemented logic which one you follow the same thanks @Mark Markov

0 votes
Ramesh Lakshmanasamy June 14, 2018

Using java API. @Alexey Matveev 

Alexey Matveev
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 14, 2018

It would be like this:

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.priority.Priority


Priority priority = ComponentAccessor.getConstantsManager().getPriorityObject("priority name")
0 votes
Alexey Matveev
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 14, 2018

Hello,

Where do you need this info? By using Jira Java Api or Jira Rest API? Or somehow else?

Alexey Matveev
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 14, 2018

It would be like this:

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.priority.Priority



Priority priority = ComponentAccessor.getConstantsManager().getPriorityObject("priority name")
Mark Markov
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 14, 2018

Dear @Alexey Matveev

That method will not work, because getPriorityObject() accept priority id, not name.

Ramesh Lakshmanasamy June 14, 2018

@Alexey Matveev i am getting null while using getPriorityObject().

Thanks @Mark Markov

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events