Forums

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

Copy reporter from linked issue

Shreyas Racherla June 27, 2018

Hello,

How do I copy reporter from a linked issue in Jira cloud?

In server we use groovy and copy reporter in script runner. How do we do the same in JIRA cloud?

 

Thanks a ton.

2 answers

2 accepted

1 vote
Answer accepted
Kristian Walker _Adaptavist_
Community Champion
July 10, 2018

Hi Shreyas,

I have created some example code which shows how you can get the set different user picker fields in a script run from the Script Console which can be viewed here. This code will show you how to set the assignee, reporter and custom user picker fields on an issue and can be used to help you modify your script.

If this answer has solved your issue can you please accept it in order to mark this answer as correct for users who are searching for a similar issue.

Regards,

Kristian

Shreyas Racherla July 10, 2018

Thanks Kristian. This works.

1 vote
Answer accepted
Alexey Matveev
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.
June 27, 2018

Hello,

There is ScriptRunner for Cloud as well. Have a look at it:

http://scriptrunner-docs.connect.adaptavist.com/jiracloud/quickstart.html

Shreyas Racherla July 9, 2018

@Alexey Matveev

The sample script runner script: 

def issueKey = 'PROJ-13'
def newSummary = 'Updated by a script'

def result = put('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.body([
fields:[
summary: newSummary
]
])
.asString()
if (result.status == 204) {
return 'Success'
} else {
return "${result.status}: ${result.body}"
}

have options to set text fields. But using the same to set a reporter field gives the following error:

400: {"errorMessages":[],"errors":{"reporter":"data was not an object"}}

 

How do I set a user field? 

 

Thanks.

Alexey Matveev
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.
July 9, 2018

I do not have ScriptRunner for Jira Cloud, but I guess it should be like this:

[fields:
[
    summary: newSummary,
    reporter: [
      name: jirauser
    ]
  ]
]
Shreyas Racherla July 10, 2018

Thanks Alexey. This works.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events