Hi,
I am using the built-in scriptrunner listener to clone an issue. I need to add the value of a field from the source issue as a comment on the destination issue but I dont get that to work. In the additional issue actions section I have this piece of code:
def cfRP = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == 'Remediation Plan'}
def comment = sourceIssue.getCustomFieldValue(cfRP)
CommentManager commentManager = ComponentAccessor.getCommentManager()
def CurrentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
UserManager userManager = ComponentAccessor.getUserManager()
ApplicationUser user = userManager.getUserByName(CurrentUser.name)
def issue = event.issue as Issue
commentManager.create(issue, user, comment, false)
The problem is that the comment is created in the source issue instead of the destination issue. I have also put the last two lines of code above inside the doAfterCreate function but it errors out.
Any help is greatly appreciated.
Thank you