I am attempting to write a bit of code that will be used as a scriptrunner postfunction. The goal is that when an issue gets transitioned all of the comments get deleted.
So far I have come up with this
delete("/rest/api/2/issue/22718")
.header("Content-Type", "application/json")
.body([
fields:[
comment
]
])
but I get an error about the comment
CorrelationId: 894d7210-838d-4549-b5ea-cf7bbb005c07
RUN Script identifier: 9e6a3000-0bd1-4fa4-9545-d301488a8259 Took: 100ms Logs:
2019-12-26 23:20:37.553 ERROR - No such property: comment for class: Script1 on line 4
2019-12-26 23:20:37.572 ERROR - Class: com.adaptavist.sr.cloud.events.ConsoleScriptExecution, Config: [:]
What am I doing wrong here? Im having trouble finding information about deleting with scriptrunner.
Ive also looked at the atlassian documentation and the delete comment command but I dont really understand how to translate the api request into a scriptrunner script.
https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issue-issueIdOrKey-comment-id-delete
any help would be appreciated.