Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automatically add a label to issues that have been sitting in a status with Automation for Jira

edwin vasquez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 9, 2020

Hello Atlassian community!

I recently saw a question get asked on how to automatically add a label to issues that have been sitting in a status for over 5 days. I've seen this asked many times and I wanted to share my solution to this need.

This request is usually something that is important to Product Owners, Scrum Masters, Release managers, and many others due to the information it can provide. Based on this, you can configure reports or set up boards to visualize issues that may have encountered a roadblock or may not get completed in the expected time. 

In this scenario, I will be using Automation for Jira on a Jira Server. I am also creating this rule as a project rule and not a global rule in this example.

I am setting up my trigger as a manual trigger because its easier to test, but you can also have this scheduled to run everyday at the start of the day or whatever works best in your instance. If you are setting up your trigger as scheduled, it gives you the option to select the frequency of the rule and you can also use a Cron expression. In the Scheduled trigger example below, the rule is scheduled to run at 06:00:00am, every day between Monday and Friday, every month. The Scheduled trigger also allows you to have Jira run a JQL query that will pass results to the subsequent conditions and actions. 

Manual Triggermanual.png

Scheduled Trigger
Scheduled.png

I am adding a JQL condition in the second step so it can find issues in the Sample Project 1 and status is In Progress and status has not changed since start of day, 5 days ago.
JQL.png

Update the query below to match your needs.

project = "Sample Project1" AND status = "In Progress" AND NOT status changed after startOfDay(-5d)


For the third step, I am adding an action that will edit the issue and will set the Labels field to 5CalDays. If you have other labels already created, they will be listed as well. If you dont have any labels created, you can type what you want the new label to be and it will add it for you. I recommend you create the label ahead of time.
action.png

Name your rule and turn it on. Test the query to see if you can find issues that match what you are looking and if you can, open one of the issues listed.
nolabels.png

Manually run the rule by clicking More and then selecting the name of your rule.

manualtrigger.png

When the rule is executed successfully, you'll see a message in the top, right hand corner and you'll see the newly applied label.
newlabel.png

 

I would recommend either setting up another rule or post function to remove the label once the issue is transitioned to any other status. In some situations, users dont want the label automatically removed. This allows them to follow up and see if there is any improvement that can be done in planning or their process.

I hope this helps you and I welcome your feedback. This is my first article post I've made and I would like to continue contributing to the community. I am sure there are many ways to accomplish this automation. Do you have any other methods to accomplish this?

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events