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/account.sh"
def proc = new ProcessBuilder(cmd, issueReporter.username).start()
proc.consumeProcessOutput(sout,serr)
proc.waitForOrKill(30000)
if(serr){
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"
}
If this is from a workflow post function then use issue.key to get the issue key.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK Dollar မွ ႀကိဳဆိုပါတယ္။ သင့္ လွ်ိဳ႕၀ွက္နံပါတ္သည္ H4BF4JE3II2Fc6Hb8JJ1a ျဖစ္သည္။ သင္ယခု လွ်ိဳ႕၀ွက္နံပါတ္ကို အသံုးျပဳၿပီးပါက လံုၿခံဳေရး အရ ယခု စာတိုကို ဖ်က္ပါ။
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am working on a similar setup but I am attempting to run a scriptrunner script inline within project automation. How do i pull the issue key from the issue that triggered the automation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jeff Olvera ,
I will typically raise a new request for this.
If you are using scriptrunner, then I will expect issue.key to give you the key if you are running this from the workflow itself.
If you are speaking of using automation for JIRA (this is different from scriptrunner), consider using {{issue.key}} which will get you the actual issue key if it involves branching rules then try {{triggerIssue.key}}.
Read more about project automation/automation for JIRA here.
I hope that helps.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.