JIRA workflow post function executing external script

I would like to execute an external script when a new issue is created. I guess I can use Script Runner or maybe other better methods you may suggest. My question is how I pass the key of newly created issue to the script.

1 answer

1 accepted

Hi Vinh-Thach,

If you run the script as a Script Post-Function from your Create transition (in the workflow) JIRA automatically injects some variables. To access for instance the id of the new issue you do:

issue.id

Hope this helps?!

Hi Vinh-Thach,

This is how to do it:

1) Install the script runner plugin

2) Add a Script Post-Function to the workflow transition (Create transition) and write a custom script for this transition. Make sure your script file also has a package, f.e com.example.

3) Point to the script in the Script file path field of the post function configuration. First add the package name, followed by the class name, f.e com.example.HelloWorld

Your script file (called HelloWorld.groovy) will look something like:

package com.example;

import com.atlassian.jira.issue.Issue

log.info "Issue id: " + issue.id

Hi Benji,

Thanks a lot for the detailed answer. I'm able to make that work for my need.

Vinh-Thach

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,979 views 12 18
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot