Skip to main content
How to align your team on the Definition of Done: on-prem tutorial
Share on socials
Multiple checklists being stamped as done once all the tasks are ticked off
A photo of Lawrence Andrews with an orange background
Lawrence Andrews
16th April, 2024
Jira
Data Center
Server
scripting
Work management
Data center icon
Server icon

How to align your team on the Definition of Done: on-prem tutorial

Learn how to align your team on the Definition of Done using features in ScriptRunner for Jira on-prem.
As we mentioned in our Definition of Done: Cloud tutorial blog post, done can mean different things to different people at different stages of a project. That's why deciding on a Definition of Done (DoD) is important: to help clear up any potential misunderstandings.
To ensure your team understands and meets the DoD, you can leverage some features in ScriptRunner for Jira on-prem, such as workflow functions, conditions, validators, and post-functions.

Definition of Ready?

If you need to brush up on the Definition of Ready, take a look at our blog post.

1. Workflow Validators

Create custom validators on workflow transitions that enforce your DoD criteria before an issue can move to the 'Done' status. For example, you can check if all required fields are filled out, if all sub-tasks are completed, or if code has been reviewed.

Workflow validators

1// Example validator script to check if all sub-tasks are completed
2if (issue.subTaskObjects.any { it.status.name != "Done" }) {
3  invalidInputException("All sub-tasks must be completed before marking this issue as Done.")
4}

2. Conditions

Add conditions to transitions that only allow issues to move to 'Done' if they meet certain criteria. This could include having a minimum number of logged work hours or mandatory approvals.

Conditions

1// Example condition script to require sign off approval
2// In this example, "Signed off" is a checkboxes custom field
3// that must have the required items checked off before allowing a transition
4def requiredApprovals = ["Management", "Tech lead", "Change Approval"]
5
6if (issue.getCustomFieldValue("Signed off by") != requiredApprovals) { 
7  false // Transition will not be available
8} else {
9  true // Transition will be available
10}

3. Post-Functions

Implement post-functions to automate certain actions when an issue transitions to 'Done'. This could involve adding a comment, updating a field, or triggering a webhook.

Post-functions

1// Example post-function script to add a comment when issue is transitioned to Done
2issue.addComment("Issue marked as Done. All DoD criteria met.")

4. Listeners

Use listeners to monitor issue events and perform additional checks or actions when issues are updated or transitioned. This can help ensure DoD compliance throughout the issue lifecycle.

Listeners

1// Example script for listener - On update check custom field and send a slack message
2// if the custom field value is set to a given value
3import com.onresolve.scriptrunner.slack.SlackUtil
4
5if (event.issue.getCustomFieldValue("Ready for QA?") == 'Yes') { 
6  SlackUtil.message( 
7    "slack",                // Identifier you provided when creating the resource
8    "acme-QA",             // channel name or ID, or user email
9
10"${event.issue.key} is ready for QA" // Message text
11
12)
13
14}

5. Scripted Fields

Create scripted fields that display the completion status of DoD items. This can serve as a visual checklist for team members to ensure all criteria are met before closing an issue.

Scripted Fields

1// Example scripted field to show DoD completion status
2def dodCompleted = issue.subTaskObjects.every { it.status.name == "Done" } 
3return dodCompleted ? "DoD Met" : "DoD Not Met"

6. Dashboard Gadgets

Use ScriptRunner's JQL functions and scripted gadgets to create dashboards that track the progress of issues against the DoD criteria.

Final tips

Remember to tailor these scripts to your specific DoD criteria and test them thoroughly in a staging environment before deploying to production.
By integrating these checks into your Jira workflows, you can automate the enforcement of your Definition of Done and ensure consistent quality across your projects.