I’m facing a problem while using a Groovy script to log work in JIRA. Here’s a sample code snippet:
componentMgr = ComponentManager.getInstance()
workLogMgr = componentMgr.getWorklogManager()
for(int iteration = 0; iteration < 5; iteration++) {
logEntry = new WorklogImpl(workLogMgr, issue, null, issue.reporter.displayName, issue.title, new Date(), null, null, 3600)
workLogMgr.create(issue.reporter, logEntry, 0L, false)
}
Alternatively:
for(int iteration = 0; iteration < 5; iteration++) {
inputParams = WorklogInputParametersImpl
.issue(issue)
.startDate(new Date())
.timeSpent('1h')
.comment('Note')
.buildNewEstimate()
validationResult = wls.validateCreate(context, inputParams)
wls.createAndAutoAdjustRemainingEstimate(context, validationResult, true)
}
The outcome I’m seeing is that while I log 5 entries, it only displays 1 hour, not the expected total of 5 hours.
This behavior occurs on the latest script runner add-on with JIRA versions 6.1 and 5.1.7.
Can anyone suggest a solution? Thank you!
Best regards,
Sergey