Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×On Jira Software Cloud, I'm using the ScriptRunner Clone Issue Post Function to create a child issue automatically.
In the 'Additional Code' section I can update some fields for the cloned issue, for example:
issueInput.fields.summary = "Prefix " + issueInput.fields.summary;
However, I cannot seem to set a comment on the to-be-created cloned issue.
On Server, this was done as:
doAfterCreate = {
// Add Comment
// dispatch an event after creating the comment
final
boolean
dispatchEvent = true
// the body of the comment
final String commentBody =
"Auto-generated Issue"
// the author of the comment will be the logged in user
def
author = ComponentAccessor.jiraAuthenticationContext.loggedInUser
ComponentAccessor.commentManager.create(issue, author, commentBody, dispatchEvent)
// Update Issue
issueManager.updateIssue(loggedInUser, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
Please check this docs:
- https://www.youtube.com/watch?v=9gppxfiEhxU
Both links are not exactly what you need but you can see an example how to add comment in Jira Cloud.
Regards,
Seba
Thanks for your reply.
The information you shared handles adding a comment to an already existing issue.
In that case I can indeed use post("/rest/api/3/issue/${issue.key}/comment")
However, the crux here is that I want to pass a comment to a issue that has not been created yet (during the Clone action), so there is no issue.key yet.
I was assuming I need to use issueInput.update somehow ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ask Script runner support. Maybe they will have solution for that.
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.
I'm afraid not...
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.