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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 get the issue priority with Scriptrunner for Jira Cloud

How can I read the issue priority with a ScriptRunner?

4 answers

1 vote
Mario Abud Community Leader Jan 26, 2020

Hi @Alex Kuterman

issue.get("priority").getName() //return the name of priority of the issue.

issue.getPriority().getId() //return the ID of the priority of the issue

Regards

Hi @Mario Abud,

I am using Jira Cloud.

I cannot use the getName() method

Hi @Alex Kuterman 

In Jira Cloud, everything you do with Scriptrunner is by JIRA REST API.

So simply follow the REST API:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/?utm_source=%2Fcloud%2Fjira%2Fplatform%2Frest&utm_medium=302

And create a listener in Scriptrunner to perform a REST API to get the issue priority

Hi Alex,

Thank you for your question.

I can confirm in ScriptRunner for Jira Cloud that you can call the Issue API which is documented in the Atlassian documentation page located here with a Get request.

Calling this API will return the JSON for all fields on the issue and one of the fields inside of the JSON will be the Priority field and you will see in the JSON the structure used to store the data for the field in order to determine how to extract its value.

I can confirm that the easiest way to test this is to navigate to the Script Console page inside of ScriptRunner for Jira Cloud and to click on the link named Get Issue Fields in the Examples section below the code box.

This will populate the code box with an example script to call the Issue API and all you will need to is to change the issueKey variable to your Issue Key and run the script in order to return the JSON showing all the fields on the issue. 

I hope this information helps.

Regards,

Kristian

0 votes

Hi @Alex Kuterman

Not my area of expertise, but I found this answer in a similar question which might be of use :)

Ste

Hi @Stephen Wright _Elabor8_ ,

The answer you attached is for Jira Server.

It doesn't work on Jira Cloud

Suggest an answer

Log in or Sign up to answer
TAGS

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