Automation: Automatically move issues based on conditions on sprint start

Prabh May 7, 2021

Hi.

I'm looking to add some automation in for some of my sprint boards. In short I want Jira to remove any issues that do not meet the Definition of Ready (have SP and an assignee added, and have the DOR checklist completed) when a sprint is started. Ideally I would also then trigger a message via web hook to the Slack channel.

So far I've managed to do this (see screenshot below), but struggling to work out how I can add an action which removes the issue from the sprint. Any ideas?

Screenshot 2021-05-07 at 08.43.39.png

2 answers

1 vote
Bill Sheboy
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.
May 7, 2021

Hi @Prabh  -- Welcome to the Atlassian Community!

I wonder if the team is mitigating a symptom and perhaps missing the root cause of this problem...

From what you describe, your team is dealing with starting sprints with items that are not ready to be worked on yet based upon your definition of ready.  Asking "why" that is happening, may lead to discussion of...

  • Communication issues (for example, starting the sprint before planning has happened)
  • Sprint planning issues (for example, skipping some steps during planning to validate the work is ready for sprint-start)
  • Understanding issues (for example, perhaps a leader is insisting the sprint start, regardless of work request readiness)

Automatically removing things from the started sprint could lead to unintended consequences.  As an alternative, what do you think of this: create a quick filter to identify issues you consider not ready, and *always* check it during sprint planning and before starting the sprint?

Best regards,

Bill

0 votes
Mykenna Cepek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2021

To remove an Issue from a Sprint, you simply remove that particular Sprint from the Sprint field in the issue.

Unfortunately, the easy approach to this in Automation doesn't seem to allow you to remove just one Sprint from the Sprint field. The only option in the "Edit Issue" action is to clear the field.

This has the unfortunate side-effect of removing any past Sprints listed there. That might affect reporting and some metrics. But if that's ok, it's the easiest way.

- - - - - - -

If you have to maintain any past Sprints in the Sprint field, then you'll need to be much, much trickier with your Automation rule. It's still an "Edit Issue" action, but you have to get into the "More options" area and use JSON.

NOTE: This will be difficult if you've not done much scripting, JSON, and/or software development.

I'll point you to the parts of the documentation for Automation that will help you solve this...

Here's a starting point for learning about how to use JSON for advanced issue editing in Automation:

https://confluence.atlassian.com/jirasoftwarecloud/advanced-field-editing-json-993927646.html

For reference, the JSON to clear the Sprint field (which can be done more easily as I described above) would look like this:

{
    "fields": {
        "Sprint": null
    }
}

But to maintain any older Sprints in that Sprint field, you'll need to instead remove the current Sprint from that field (instead of just clearing that field), so that the older Sprints remain.

Since you're using a Sprint-based trigger, you will have access to the newly started sprint:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/#Smartvaluesgeneral-Availableproperties.12

You won't strictly use a Smart Value in the JSON though (you can access them more directly). But the above gives you guidance about the naming.

The approach would be to iterate over the current values in the Sprint field (if any), and keep only the values that do not match the current sprint. Iterating over values in a field is described here (near the end):

https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/

Conditional logic will be needed to identify the current Sprint and remove it:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-conditional-logic/

Here's another reference to some code that is trying to solve a slightly different problem, but will give you a sense for the syntax and rationale. Scroll down to @Bill Sheboy's response on 23-Nov-2020:

https://community.atlassian.com/t5/Jira-Software-questions/how-to-delete-specific-issue-components-using-automation-for/qaq-p/1534864

One tip when doing advanced Automation rules is to take it in steps, and use the Audit Log action liberally to see what's going on.

If you do get a rule like this working, sharing the JSON back here with the Community would be super helpful. Best wishes!

Suggest an answer

Log in or Sign up to answer