Hi All,
I have this piece of code adding auto comment in the ticket during the transition
I want to add reporters name in the comment.
Can somebody help?
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.comments.CommentManager
ComponentManager componentManager = ComponentManager.getInstance()
CommentManager commentManager = componentManager.getCommentManager()
commentManager.create(issue, transientVars.context.caller, "This ticket is now closed, please check the root cause field for futher information", false)
Try this:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.*
import com.atlassian.jira.user.ApplicationUser
MutableIssue issue = (MutableIssue) issue
CommentManager comMgr = ComponentAccessor.getCommentManager()
ApplicationUser user = ComponentAccessor.getUserManager().getUserByKey("bot-account")
comMgr.create(issue,user, "This ticket is now closed, please check the root cause field for further information , Reporter name = $issue.reporter.name", false)
Thank you very much for your help and following modification gave me the required comment.
Reporter name = $issue.reporter.displayName"
And one more thing. Do you know a way to to insert customfields as well?
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.