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 All
In the scriptrunner listener for issue created when I append $${issue.key} it is not working in put function, however if I hard code the key like XXX-152 it works
I am trying to update the issue.
What is the correct way to update issue in scriptrunner listener. Please let me know
This does not work
def issueKey = issue.key
def result = put('/rest/api/2/issue/${issue.key}') .header('Content-Type', 'application/json') .body([ fields:[ summary: newSummary ] ])
This works with hardcoded key
//def issueKey = 'DWS-152'
def issueKey = issue.key
logger.info("${issueKey} or ${issue.key}")
def newSummary = 'Updated by a script'
def result = put('/rest/api/2/issue/XXX-166')
.header('Content-Type', 'application/json')
.body([
fields:[
summary: newSummary
]
])
.asString()
if (result.status == 204) {
return 'Success'
} else {
return "${result.status}: ${result.body}"
}
Please let me know.
Abe
Hi @AbrahamA
Can you try this
def issueKey = issue.key
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}"
}
If I use ${issueKey} as part of put URL here is what I get
2 2023-03-28 03:14:50.429 INFO - PUT /rest/api/2/issue/${issueKey} asString Request Duration: 14ms 2023-03-28 03:14:50.434 ERROR - java.net.URISyntaxException: Illegal character in path at index 110: https://us.argon.polaris.connect.product.adaptavist.com/proxy-service/rest/api/1/jira/proxy/rest/api/2/issue/${issueKey} 2023-03-28 03:14:50.448 ERROR - Class: com.adaptavist.sr.cloud.events.WebhookExecution, Config: null
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay @AbrahamA then the issue may be something else
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.