[英]Groovy (Script Runner/Jira) Get WorkLog from Parent Issue to SubTask
I have a problem with get "Time spent" from Parent Issue to SubTask. 我有一个问题,从父问题到SubTask得到“花费的时间”。 Code below could get "Time spent" from WorkLog in Parent Issue to customfield with name "timeLogged", but I need set "Time spent" to Worklog not to customfield.
下面的代码可以从父项问题中的WorkLog获得“花费时间”到名为“timeLogged”的自定义字段,但我需要将“花费的时间”设置为Worklog而不是customfield。 Something like - Copy worklog from Parent Issue to Sub-Task.
类似的东西 - 将工作日志从父问题复制到子任务。
def cfManager = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("timeLogged")
//timeLogged - customfield
def changeHolder = new DefaultIssueChangeHolder()
cfManager.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cfManager), parentIssue.getTimeSpent()),changeHolder)
I found this - https://docs.atlassian.com/jira/7.1.0/com/atlassian/jira/issue/worklog/WorklogManager.html : 我发现了这个 - https://docs.atlassian.com/jira/7.1.0/com/atlassian/jira/issue/worklog/WorklogManager.html :
.... def worklog2 = new WorklogImpl( worklogManager, subtask, worklog.id, subtask.reporter.name, subtask.summary, new Date(), null, null, summ ) .... def worklog2 = new WorklogImpl(worklogManager,subtask,worklog.id,subtask.reporter.name,subtask.summary,new Date(),null,null,summ)
worklogManager.update(subtask.reporter, worklog2, 0L, false) } } .... worklogManager.update(subtask.reporter,worklog2,0L,false)}} ....
And it works !! 它的工作原理!! :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.