JIRA自定义脚本验证器:检查Epic中的链接问题是否为“完成”
我正在尝试编写一个工作流验证器,以确保EPIC中的所有问题都处于“完成”状态。
这就是我到目前为止得到的:
import com.opensymphony.workflow.InvalidInputException
// Set up jqlQueryParser object
jqlQueryParser = ComponentManager.getComponentInstanceOfType(JqlQueryParser.class) as JqlQueryParser
// Form the JQL query
query = jqlQueryParser.parseQuery('"Epic Link" = {{issue.key}}')
// Set up SearchService object used to query Jira
searchService = componentManager.getSearchService()
// Run the query to get all issues with Article number that match input
results = searchService.search(componentManager.getJiraAuthenticationContext().getUser(), query, PagerFilter.getUnlimitedFilter())
if (results.getIssues().size() >= 1) {
for (r in results.getIssues()) {
//Here I want to check the status of all linked issues and make sure its "Done"
}
return invalidInputException = new InvalidInputException("Validation failure")
}
return "Validation Succes"
,我也不确定如何从工作流验证器部分进行调试。
谢谢!
I'm trying to write a workflow validator that makes sure all issues in Epic are in "Done" status.
this is what I got so far:
import com.opensymphony.workflow.InvalidInputException
// Set up jqlQueryParser object
jqlQueryParser = ComponentManager.getComponentInstanceOfType(JqlQueryParser.class) as JqlQueryParser
// Form the JQL query
query = jqlQueryParser.parseQuery('"Epic Link" = {{issue.key}}')
// Set up SearchService object used to query Jira
searchService = componentManager.getSearchService()
// Run the query to get all issues with Article number that match input
results = searchService.search(componentManager.getJiraAuthenticationContext().getUser(), query, PagerFilter.getUnlimitedFilter())
if (results.getIssues().size() >= 1) {
for (r in results.getIssues()) {
//Here I want to check the status of all linked issues and make sure its "Done"
}
return invalidInputException = new InvalidInputException("Validation failure")
}
return "Validation Succes"
and I'm also not sure how can I debug it from the Workflow validator section.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要导入
jqlquelyparser
首先:此外,除此之外,您可能需要其他一些其他导入,如 scriptrunner文档。
作为上面链接中提到的一个示例:
You need to import
JqlQueryParser
first:Also, in addition to that, you may need some other imports as mentioned in ScriptRunner documentation.
As an example that mentioned in the link above: