Hi!
I wanted to do a workflow validation where if a ticket does not have the latest unreleased version on it.
I expected that this should be possible at least with PowerScripts or ScriptRunner if not native Jira.
I've had little success:
I tried this:
if(size(key in silJQLExpression('', 'issueKey = ' + key + ' AND fixVersion in unreleasedVersions() AND not fixVersions in releasedVersions()'))) == 0){
return false, "fixVersion", "Fix Versions blablalbla.";
}
return true;
but it always says there's some error without any further info.
Any hints on how to proceed?
Below snippet will help you to check whether ticket is associated with released version or unreleased one
you can place this in validator or condition(scriptrunner functions)
def versions = issue.getFixVersions()
for (v in versions){
if(!v.isReleased()){
return true // there is at least one unreleased version hence returning true
}
}
return false
Hope this helps
BR,
Leo
Thanks, looks great, I modified it a bit further into something like this:
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
import com.atlassian.jira.bc.issue.search.SearchService
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService.class)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def query = jqlQueryParser.parseQuery("issuekey = " + issue.key + " AND development[pullrequests].merged > 0")
def results = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
if (results.total == 1 && issue.getResolution() in ["Fixed", "Done", "Resolved"]){
def versions = issue.getFixVersions()
if (versions.size() == 0) return false
for (v in versions){
if(!v.isReleased()){
return true
}
}
return false
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.