Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to add a comment to the issues part of a released fix version?

arama mihai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2018

Hello,

I was wondering if it is possible, using Scriptrunner, to add a comment to all the issues that are part of a fix version, when that fix version is released.

If yes, please also show how.

Thank you!

2 answers

1 accepted

1 vote
Answer accepted
Daniel Yelamos [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2018

Hi Arama:

I've just tested this script and it works on release FixVersions, if you want affect versions, change the JQL

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchProvider
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter

def version = event.getVersion()
def project = version.getProject()

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)
def commentManager = ComponentAccessor.getCommentManager()

//You should pick a user to make these comments, this user should have permissions
// for the JQL query and the comment
def user = ComponentAccessor.getUserManager().getUser("admin")

// edit this query to suit
def query = jqlQueryParser.parseQuery("project = ${project.key} and fixVersion = ${version.id}")
def results = searchProvider.search(query, user, PagerFilter.getUnlimitedFilter())
String comment = "This issue has been fixed and released in version ${version.name}"

log.debug("Total issues: ${results.total}")

results.getIssues().each {documentIssue ->
log.debug("Commented on release on issue: ${documentIssue.key}")
commentManager.create(documentIssue, user, comment, true)
}

I've done this with a custom listener on VersionReleaseEvent.

Do say if I can help you further.

Cheers!
DY

arama mihai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2018

Thanks a lot, it works great!

0 votes
arama mihai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2018

Hi @Orkun Gedik , @Orkun Gedik

Thank you for your reply from yesterday. 

I don't know why that question was removed. 

Yes, I would need help with coding the listener, if possible.

Thank you!

Suggest an answer

Log in or Sign up to answer