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

Get issue key for current context

maya.grozin January 18, 2021

I am using Jira cloud with script runner. I'm able to fetch a certain issue by hardcoding the issue key, however I want this to be dynamic by using the current issue that triggers my post-function:

def issueKey = 'WS-456'

def issue = get("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body

I want 'WS-456' to be dynamic please

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Ravi Sagar _Sparxsys_
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.
January 18, 2021

Hi @maya.grozin 

Add this on top of your code.

def issueKey = issue.key

I hope it helps.

Ravi 

maya.grozin January 18, 2021

Hello, 

Thanks for your response - unfortunately I have tried this and it is not working.

Maya

Ravi Sagar _Sparxsys_
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.
January 19, 2021

Hi @maya.grozin 

In that case I suggest raise a support request so someone cane take a look at it.

All other scripts are working?

Ravi

TAGS
AUG Leaders

Atlassian Community Events