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!
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.ComponentAccessorimport com.atlassian.jira.issue.search.SearchProviderimport com.atlassian.jira.jql.parser.JqlQueryParserimport com.atlassian.jira.web.bean.PagerFilterdef 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 commentdef user = ComponentAccessor.getUserManager().getUser("admin")// edit this query to suitdef 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
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.
Thanks a lot, it works great!
It looks like you're new here. Sign in or register to get started.