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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • 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

Using scriptrunner to call the current issue key, send the reporter id to a shell script

I have worked out part of the issue. I can get the code to activate a shell script on the server side when an issue passes through a transition containing the scriptrunner post function. The code also send the reporter ID parameter to the shell script. However I can only get this to work when I manually enter the issue key. Can anyone assist with allowing the code to pull whatever issue key it is running on? Thank you!

Original code (manual key entry):

import com.atlassian.jira.component.ComponentAccessor

def issueId = "TES-123" // test parameter, change me later
def issueReporter = ComponentAccessor.getIssueManager().getIssueObject(issueId).reporter

def sout = new StringBuilder()
def serr = new StringBuilder()
def cmd = "/home/smithj/"
def proc = new ProcessBuilder(cmd, issueReporter.username).start()
log.error "Error exeucting shell script with standard error output: \n $serr"
log.debug "Erroring shell script had standard output:\n $sout"
} else {
log.debug "Shell script executed succesfully with standard output:\n $sout"


1 answer

1 accepted

0 votes
Answer accepted
Ismael Jimoh Community Leader Jul 12, 2020

Hi @Michael Salvio 

If this is from a workflow post function then use issue.key to get the issue key.

Hello @Ismael Jimoh 

Thank you so much! Worked like a charm!

OK Dollar မွ ႀကိဳဆိုပါတယ္။ သင့္ လွ်ိဳ႕၀ွက္နံပါတ္သည္ H4BF4JE3II2Fc6Hb8JJ1a ျဖစ္သည္။ သင္ယခု လွ်ိဳ႕၀ွက္နံပါတ္ကို အသံုးျပဳၿပီးပါက လံုၿခံဳေရး အရ ယခု စာတိုကို ဖ်က္ပါ။

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Why upgrade to Jira Service Management Premium?

We often have questions from folks using Jira Service Management about the benefits to using Premium. Check out this video to learn how you can unlock even more value in our Premium plan.  &nb...

227 views 1 6
Read article

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