Issue with Logging Work in JIRA Using Groovy Script

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

have you checked the permissions? It might be that the user doesn’t have the rights to log more than 1 hour at a a time. Try verifying if the user has proper work log permissions or the default time settings in your JIRA instance.