/** This example script post function for ScriptRunner for Jira Server shows how you can add a comment to an issue when it is transitioned.* "All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner* license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed or* amended and must be included in any circumstances where the code snippet is shared by You or a third party." */importcom.atlassian.jira.issue.Issue;importcom.atlassian.jira.component.ComponentAccessor;importcom.atlassian.jira.issue.comments.CommentManagerimportcom.atlassian.jira.user.ApplicationUser// Get a pointer to the issueIssueissueKey=issue// Get the current logged in userdefCurrentUser=ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()asApplicationUser// Get access to the Jira comment and component managerCommentManagercommentManager=ComponentAccessor.getCommentManager()// Get the last comment entered in on the issue to a Stringdefcomment="A Sample Comment"// Check if the issue is not nullif(issueKey){// Create a comment on the issuecommentManager.create(issueKey,CurrentUser,comment,true)}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.