Skip to main content
How to align your team on the Definition of Done: Cloud tutorial
Share on socials
Multiple checklists being stamped as done once all the tasks are ticked off
Kristian Walker
Kristian Walker
6th December, 2023
Jira
Cloud
scripting
Work management
Cloud icon

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

Done can mean different things to different people at different stages of the project. To clear up any misunderstandings, we decide on a Definition of Done.
What does "done" mean?
Fulfilled. Rendered. Concluded. Realised. Complete.
Done just means done... Right?
To me, done might mean code that is live in production. But to you, done might mean a completed peer review. And to a delivery team? Done might mean ready for peer review.
Done can mean different things to different people at different stages of the project, so how do we clear up any potential misunderstandings and get everyone speaking the same language? We decide on a Definition of Done.

Definition of Done

After you've created your Definition of Ready, which sets out the tasks that need to be done to complete the ticket, you can then move on to your Definition of Done.
A Definition of Done sets out a shared understanding of what it means to be "done". As a leader, you can clearly state your expectations on the team's tasks and the acceptable quality standards that should be met. As a developer creating new code, you know the task is not "done" until you've met these conditions.
With these guidelines in place, you are less likely to create delays due to debates over readiness, to release bugs or to trigger production incidents which negatively impact your customers.
To keep this shared understanding front of mind for your team, why not add a Definition of Done checklist to your Jira tickets? Why not add this checklist to all new tickets automatically using ScriptRunner for Jira Cloud.

How to automatically add a Definition of Done checklist to Jira issues

We can automatically add a comment to all new Jira issues using a Script Listener in ScriptRunner for Jira Cloud.
What is a Script Listener?
chevron icon
Script Listeners perform an action on our behalf when an event is triggered in Jira. For example, when a specific event happens, such as creating a new issue, the listener triggers an action, such as adding a pre-defined comment to that new issue.
Using this method, we can add a comment containing our Definition of Done to each newly created issue.

Looking for an on-prem tutorial?

Check out our Definition of Done on-prem tutorial.

How to automatically add a comment in Jira Cloud

In ScriptRunner for Jira Cloud, click on the Script Listeners option, then configure a new Script Listener with the following settings:
  • In the field Script Listener Called enter “Add Definition of Done checklist comment to newly created issues”
  • In the field On these events, select Issue Created Event
  • In the field On these projects, select the project(s) that you want to run the script on.
  • In the As this user box, select the ScriptRunner Add-On User so the comments are made by the user ScriptRunner.
Screenshot of Definition of Done Script Listener config

Defining when the script executes

When configuring your Script Listener, you can add conditions, in the field If the following condition evaluates to true, to restrict when the script executes. For example, you may wish to run the script only on certain issue types like Stories and Tasks, or when specific fields in an issue contain specified values. This customisation also allows you to add a different Definition of Done for different task types, teams and more.
The script below outlines how to configure this script to run only on issue types Story or Task.

If the following condition evaluates to true

1"issue.issueType.name.match('^(Story|Task)$') !=null"
The script is written using the Jira Expression Framework provided by Atlassian. You can find more examples of conditions in our Documentation that you can use to define when the script should or should not trigger.

Demonstration: Configuring the code

Expand the Script Context box to view the variables available in the script bindings for the selected event. These variables allow you to use values directly from the issue without running a separate REST API call to fetch the issue. For our Issue Created event, you can see the variables available to our script, including the chosen issue.
Screenshot of Definition of Done variables
Click image to enlarge

Enter this script into the 'Code to run' box

Modifying the code

1. On line 10, the script specifies the rich text markup for the comment in the variable adfBody, as defined by the Atlassian Document Format.
2. In this variable, you can replace the existing markup with the markup for your Definition of Done checklist.
Tip: You can use Atlassian's Document Format Builder to create your preferred document format using a visual editor.
3. Modify the script to be compatible with ScriptRunner by replacing all instances of the { character with the [ character and all instances of the } character with the ] character.
4. On line 163, the script defines the comment body in the commentBody variable, which is used to post the comment on the issue.
5. On line 171, the script then makes a REST call to post the comment to the issue in the variable named addComment.
6. In this REST API call, we convert the ADF body provided to JSON to become a valid payload for the Add comment REST API on line 173 using the JsonOutput package, which is imported on line 8.
7. On line 176 we check the response code was correct and the comment was created successfully. If it has not been created, the script throws an error to indicate the comment was not added.

And we're "done"!

When this script runs, a comment containing the Definition of Done checklist is added to new issues.
Screenshot of Definition of Done checklist comment
Using this approach, product teams and developers can check the criteria that they need to meet directly within Jira before marking the issue as done. Now, when anyone on your team says that ticket is done, you'll know exactly what kind of done they mean!

Brush up on your Definition of Ready

Learn how a Definition of Ready can help create winning user stories.