I'm looking to use a post function to create a linked issue using script runner, trying to figure out how I could replace the description of the new issue with last comment.
If you are using the "clones issue" built-in post-function, you can enter the following code into the additional issue actions:
import com.atlassian.jira.component.ComponentAccessor def commentManager = ComponentAccessor.getCommentManager() def comments = commentManager.getComments(sourceIssue) if (comments) { issue.description = comments.last().body } else { issue.description = "No comment set on source issue" }
Another Question, This transition is using a screen with the comment field, I would like to replace the description of the linked issue with this comment only when the comment is not empty.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
get the comments in the same way as above but using "issue", not sourceIssue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
in a transition, the current comment is in: transientVars["comment"] - so if that's empty no comment was added
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jamie,
If I don't want the change the new issue's description, but copy the last comment to be a comment of the cloned one, how can we do it?
I did try to use commentManager.create( issue, comments.last().owner, comments.last().body, true)
But I got the null pointer assignment error in the log and the task failed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
is the "clone issue" post function still available in the current version?
I can't find it neither in the available post functions nor in the script runner docs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.