You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!

1

Add Comment to an Issue in a Post Function

Overview

Configure a post function to add a comment to an issue when a workflow transition occurs.

Example

I work in support and when an issue transitions from 'open' to 'in progress', I want a comment to be automatically added to the ticket to let our client know we are working on their issue.

Good to Know

Specify issue values using the Groovy template syntax.

Requirements

  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
    
import com.atlassian.jira.component.ComponentAccessor // dispatch an event after creating the comment final boolean dispatchEvent = true // the body of the comment final String commentBody = """The text for your comment, which can include specific values from the issue, such as the specific issue assignee ${issue.assignee?.name ?: 'Unassigned'}""" // the author of the comment will be the logged in user def author = ComponentAccessor.jiraAuthenticationContext.loggedInUser ComponentAccessor.commentManager.create(issue, author, commentBody, dispatchEvent)
Discovered an issue? Report it here

Suggested for you