Running on premise Jira.
Project_A is client facing and Project_B is internal only.
Rather than make the users update two tickets I am looking to copy comments from Project_A -> Project_B when tickets are linked and copy comments from Project_B -> Project_A as well.
There is not a transition for either ticket taking place, just the addition of a comment.
I know I need to set up a listener (that's the easy part). I am unsure how to script the copy itself though.
Any help would be appreciated.
Hi Ron:
You want to use something like this. Mind you, I have not tested this locally, I've just looked at old code of mine:
If you have two variables "issue" and "newIssue", both of these objects are an Issue.
import com.atlassian.jira.component.ComponentAccessor
//The comment manager is needed to gain CRUD access to your comments.
def commentManager = ComponentAccessor.getCommentManager()
//This is how you parse out the event out of the params within a listener
def event = params.event as IssueEvent
//This is how you get the comment out of the event.
def comment = event.comment?.body
//And this is how you create a comment.
commentManager.create(newIssue, comment.authorApplicationUser, comment.body, comment?.groupLevel, comment?.roleLevel?.id, comment.created, false)
Do tell me if I can help you further.
Cheers!
DYelamos
Getting an error on
def event = params.event as IssueEvent
trying to work through why that is.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean an error? When you run it or is it an static compilation error? Could you send me a screenshot or the stacktrace?
If there isn't a stack trace, ignore it, and run it anyways.
Cheers!
Dyelamos
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.