Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Start CURL from scriptrunner

I try to resolve problem with Invalid Worklogs in Tempo after moving issue to another project. I wrote my own script based on this, but not work properly. I use My Groovy addon and I use CURL to serach and update date in Jira by REST API. My script find properly information in Jira, but I have problem with update a account filed. It’s look like curl2 isn’t execute. Can you take a look on my script and tell my where is a problem? I have another script listener where i execute curl command many time in one script and it’s work good. My Jira is install on Windows Server.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.issue.IssueEvent
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.label.LabelManager
import com.atlassian.jira.issue.util.IssueChangeHolder;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
import groovy.json.JsonSlurper
def JIRA_API_URL = (“”)
def user_password = “user:password”
def accountCf = “customfield_11110”
def commentManager = ComponentAccessor.commentManager
def cfm = ComponentAccessor.getCustomFieldManager()
def userManager = ComponentAccessor.getUserManager()
def user = userManager.getUserByKey(“user”)
def issue= event.getIssue()
def projId = issue.getProjectId().toString()
def issueKey = issue.getKey().toString()
def curl = “E:/curl/bin/curl.exe -u user:password${projId}”
def output = curl.execute().text
def slurper = new groovy.json.JsonSlurper()
def results = slurper.parseText(output)
def id =

def accountId = id.substring(1, id.length() – 1)
def sout = new StringBuilder(), serr = new StringBuilder()
def query = ‘{“””fields”””:{“””‘+accountCf+'”””:”””‘+accountId+'”””}}’
def curl2 = [ ‘E:/curl/bin/curl.exe’,(” -u “+user_password+” -X PUT –data “+query+” -H “+'”Content-Type:application/json”‘+” “+ JIRA_API_URL+issueKey)].execute()
curl2.consumeProcessOutput(sout, serr)
def error = curl2.waitFor();
def texto = sout.toString();
def texto2 = serr.toString();
log.debug(texto + “::” + texto2)


1 answer


What do you get as a result of running script? Error?

Suggest an answer

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

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

278 views 0 6
Join discussion

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