/
Require users to log work before transitioning an issue

Require users to log work before transitioning an issue

Problem

  • If a user is transitioning the workflow of an issue, it's expected that the user has spent some time on the issue.

  • If the user has spent time on the issue, the user should be logging work as part of standard process

Solution

Using Power Scripts™, you can make logging work a prerequisite for users before they can transition an issue.

  • First, it retrieves all worklog IDs on the issue that are attributed to the user invoking the transition with the getWorklogIdsForUser() function

  • Then it adds up all the time spent attributed to the user on the particular issue where the transition is invoked using the getWorklogLoggedHours function

  • It checks to see if the user has logged any work on the issue. If not, an error message is presented and the user cannot perform the transition.

Before you begin, make sure that:

  • Jira Core, Jira Software or Jira Service Desk is installed,

  • Power Scripts™ for Jira is installed.

Implementation

Create the following script in SIL™ Manager and apply it as a validator on a workflow transition.

This script is used to make sure the user attempting to transition the workflow has logged time on the issue. If the user has not logged time, an error message will appear and the transition will not be allowed.

interval checkUserWorklogs; string errorMsg = "You must log work to advance this issue!"; for(number id in getWorklogIdsForUser(currentUser(), key)) { checkUserWorklogs += getWorklogLoggedHours(id); } if(checkUserWorklogs!="") { return true; } else { return false, "error", errorMsg; }

Table of Contents

Related content