/
Automatically Logging Work on Issue Transition

Automatically Logging Work on Issue Transition

WorklogPRO has “Custom Log Work Field” which can be added to issue transition screens so that users can specify time spent and necessary worklog attributes when transitioning issue between different statuses.

Some times our users want more automation. For example, when a user transitions and issue from “In Progress” status to any other status, they want work to be automatically logged. You can use ScriptRunner’s “Scripted Workflow Post Function” and WorklogPRO Java API to archive this task. Following scripts shows an example of adding worklog to issue as a part of workflow transition and it also shows how to associate a custom attribute to newly created worklog.

import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.worklog.Worklog import com.onresolve.scriptrunner.runner.customisers.PluginModule import com.onresolve.scriptrunner.runner.customisers.WithPlugin import com.deniz.jira.worklog.services.attr.AttrTypeService; import com.deniz.jira.worklog.data.attr.*; import com.deniz.jira.worklog.action.*; import com.atlassian.jira.bc.*; import com.atlassian.jira.util.*; import java.time.*; import com.atlassian.jira.util.*; @WithPlugin("com.deniz.jira.worklog") @PluginModule AttrTypeService attrTypeService; @PluginModule CreateWorklogOnIssue createWorklogOnIssueHelper;