You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I'm trying to copy the values of a few fields in JIRA Cloud, using a ScriptRunner workflow post function. I got the following code to work to copy Story Points to a customfield:
def result = put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
customfield_10746: issue.fields["customfield_10119"],
]
])
.asString()
However, when I tried to also copy the Sprint field to a custom field called Baseline Sprint, by adding this line:
customfield_10739: issue.fields["customfield_10115"] I get the following error:
2017-10-05 05:56:09.734 WARN - PUT request to /rest/api/2/issue/TRAIN-17 returned an error code: status: 400 - Bad Request body: {"errorMessages":[],"errors":{"customfield_10739":"Operation value must be a string"}} 2017-10-05 05:56:09.851 INFO - PUT /rest/api/2/issue/TRAIN-17 asString Request Duration: 2218ms 2017-10-05 05:56:09.852 INFO - Run script completed
Any ideas on how to do this? Again this is JIRA Cloud. Thanks!
I ended up doing this through a script listener, which pulls the most recent sprint from the Sprint field & copies it to a field called 'Current Sprint.' This needs some cleaning up, but it's working for now:
def projectKeys = ['TRAIN', 'MEST', 'CONS', 'FB', 'CAMP']
if (!(issue.fields.project.key in projectKeys)) {
return
}
def issueKey = issue.key
def thing = issue.fields.customfield_10115.last().tokenize(',')
def latest_sprint = thing[3].tokenize('=')[1]
def result = put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
customfield_10752: latest_sprint
]
])
.asString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.