您好我使用adaptavist scriptrunner创建了一个创建子任务的小脚本:
ApplicationUser user = // .. obtaining the user
MutableIssue parent = // .. obtaining parent issue
MutableIssue child = issueFactory.getIssue()
// ... filling child with some data
// here the errors appear:
// workflow error
Issue subtask = issueManager.createIssueObject(user, child)
// null pointer
subTaskManager.createSubTaskIssueLink(parent, child, user)
我试图找出错误的原因,看起来我发现了问题所在:
child.getId()返回null。我错过了什么? getIssue()
应该返回没有ID的空白问题吗?
Jira版本7.1.7
答案 0 :(得分:1)
这应该有效:
答案 1 :(得分:0)
MutableIssue child = issueFactory.getIssue()
// issueFactory.getIssue(), returns an instance of MutableIssue,
// that will be used to set issue data, here issue is not yet created
// in jira yet hence issue id and key will be null here
// ...
Issue subtask = issueManager.createIssueObject(user, child)
// issueManager.createIssueObject(user, child), creates the issue
// in the jira and after execution of this statement, you can retrieve
// issue id and issue key