[GROOVY/CUSTOM FIELD] Key of current issue

Maciej Olszewski December 9, 2016

Hello,

I am trying to create scripted custom field which is based on JQL. I only don't now how to take lets name it... current issue key.
for example i have custom field "Number of children"  and want to collect by JQL in script all tickets for which current issue is parent.

def key = current ticket key
def jql = "parent = " + key
...rest of code

It should look like this but i don't know how to get key of current issue...
Thanks in advance,

Cheers,
Maciej 

1 answer

1 accepted

5 votes
Answer accepted
Konstantin Mitov [Botron]
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.
December 9, 2016

Hi Maciej

Try something like this:

Issue issue = issue
def key = issue.getKey()
def jql = "parent = " + key

This should get you the key of the current key.

Regards,

Konstantin

Maciej Olszewski December 11, 2016

Thank you!

Suggest an answer

Log in or Sign up to answer