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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to fetch the Priority of current issue in JIRA?

Requirement: This will be applicable for all the issues of a given project. There is a customfield Promised Delivery Date in the form. Based on the priority of an issue, this field has to be enabled/disabled for the user.

When the priority = Critical, the customfield has to be disabled. Otherwise it will remain enabled. Hence I wanted a groovy script to fetch the current issue's priority. I have done with the enable/disable part.

 

2 answers

0 votes
Ismael Jimoh Community Leader Jul 01, 2021

Hi @Pranita Warik 

Normally depending on where you are getting it from, you can either use:

issue.priority //When you are doing this from the workflow
issue.getPriority() //every where even the above defaults to this in reality.

Read more about this here: https://docs.atlassian.com/software/jira/docs/api/7.1.2/com/atlassian/jira/issue/Issue.html

Regards

0 votes

Not tried it recently, but assuming you're using Behaviours, then

def prio = getFieldByName('Priority')
def prioValue = prio.value

Should get you the name of the current value selected for priority

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

872 views 2 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you