我目前正在使用JIRA 7.3并安装了scriptRunner,我不熟悉groovy,我也不知道从哪里开始,以及每个JIRA经理的意思,在哪里可以找到这些经理及其他人的清单描述。
我希望有一个功能,当其中一个链接问题移动时,Epic将自动转换为“进行中”。此外,当所有故事转移到“待办事项”或“完成”时,Epic将自动转换到与链接问题相同的状态。
任何指向教程,视频或带有解释的脚本的链接都会有所帮助。非常感谢您的帮助
答案 0 :(得分:0)
查看下面的示例,其中显示了如何查找问题的链接史诗以及通过执行转换来更新史诗的状态。这是ScriptRunner的Groovy脚本。我在脚本控制台中对此进行了快速测试,但您可以使用具有工作流转换的post函数的此类脚本。
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.issue.IssueInputParametersImpl;
import com.atlassian.jira.bc.issue.IssueService
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
IssueManager issueManager = ComponentAccessor.getIssueManager();
IssueService issueService = ComponentAccessor.getComponent(IssueService);
CustomField epicLinkField = customFieldManager.getCustomFieldObjectByName('Epic Link');
//hardcode lookup to issue for script console:
MutableIssue issue = issueManager.getIssueObject("FID-15");
IssueInputParameters issueInputParameters = new IssueInputParametersImpl([:]);
//lookup the corresponding epic via the subtask's parent
MutableIssue epic = issueManager.getIssueObject(
(String)issue.getCustomFieldValue(epicLinkField)
);
// 21 is the transition ID in my workflow
IssueService.TransitionValidationResult validationResult =
issueService.validateTransition(epic.getAssignee(),
epic.id, 21 as Integer, issueInputParameters)
def errorCollection = validationResult.errorCollection
log.error(errorCollection)
if (! errorCollection.hasAnyErrors()) {
issueService.transition(epic.getAssignee(), validationResult)
log.error("OK")
}
else {
log.error("ERROR")
}