Forums

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

How to fetch issue key in scriptrunner

Zeeshan Malik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2020

Hi,

I have a specific requirement, where we want to do some processing (on the issue) behind the scene once a file is attached to the issue.

I am trying to achieve this through scriptrunner plugin. I am able to catch the event once the file is attached. I am also able to fetch that particular attached file in my script but I am not able to find the issue key for the issue where that file is attached. Unless, i have the issue key, I can't change the issue fields in my script.

Please help on how this can be achieved. Note that i am using Jira Service Desk Cloud version.

Regards,

Zeeshan Malik

1 answer

1 vote
Ismael Jimoh
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.
November 25, 2020

Hi @Zeeshan Malik 

Please try the getKey() method.

def myIssue = event.issue
def myIssueKey = myIssue.getKey()

Something like this should work if you are fetching from an event.

If it is from a workflow, they a simple issue.key should normally return your issue key.

Regards. 

Ismael Jimoh
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.
November 25, 2020

Apparently for Jira cloud, you should be able to use issue.key as suggested here: https://scriptrunner-docs.connect.adaptavist.com/jiracloud/script-listeners.html#_issue_created

Sheeraz Ali
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 26, 2020

Hi,

Can we get the issue on "Attachment created" Event on script listener (script runner cloud version) as there is no "event" keyword defined! all i can find are following variables

baseUrl

logger

attachment

timestamp

webhookEvent (type: String in our case the value is attachment_created)

regards,

Sheeraz

Like # people like this
Zeeshan Malik
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 26, 2020

Hello, can someone help on this? This is Urgent?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events