Scenario
- 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
We'll show you how to enforce logging work using Power Scripts™ for Jira; a powerful scripting tool to help automate your Jira.
What This Script Does
- First, it retrieves all worklog IDs on the issue that are attributed to the user invoking the transition with the getWorklogIdsForUser() routine
- Then it adds up all the time spent attributed to the user on the particular issue where the transition is invoked using the getWorklogLoggedHours routine
- 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.
Prerequisites
- You have Jira Core, Jira Software or Jira Service Desk installed
- You have Power Scripts™ for Jira installed
Implementation
Create the following script in SIL Manager and apply it as a validator on a workflow transition.
See also
- Disabling inline edits in Jira
- Forbidding users to create some issue types
- Hide fields from users not in a project role
- Limit Number of Characters in Text Field
- Lock an issue - a better variant (Live Fields)
- Locking Issues
- Making an issue read-only
- Require an issue to have attachments
- Restrict issue type availability by user
- Restrict workflow based on status of dependencies
- Validator for component lead