How to update a story's target start and end dates based on the sprint dates using Jira Automation

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Purpose

Automation for Jira does not have native support for configuring the Jira fields "Target Start" and "Target End". When selecting "choose fields to set..." in an Edit issue action, for example, the fields are not present in the drop down.

This feature request is being tracked at JIRAAUTOSERVER-159

Using Smart Fields, however, we can overcome this limitation. The solution below explores how to update the "Target Start" and "Target End" fields based on the issue's sprint using Jira Software's Automation feature

Solution

Automation Rule

  • In the lower left corner of your Jira project, click Project Settings
  • On the left pane, choose Project automation
  • Create Create rule to create a new rule
  • Trigger: Sprint Started
    • Boards: Pick your boards
  • New Component: Branch Rule / related Issues
    • Type of related issues: Issues in the sprint
    • Rule restricted to project: Your project
    • New Action: Edit Issue
      • Under Additional Fields, enter:
      • {
          "fields": {
            "Target start": "{{issue.sprint.last.startDate.jiraDate}}",
            "Target end": "{{issue.sprint.last.endDate.jiraDate}}"
          }
        }

The completed rule should look like this:

Result

Once the sprint is started, issues within that sprint will have their Target Start date set to the sprint's start date, and the Target End date set to the sprint's end date

Theory of operation

Sprint started triggerAutomation for Jira will listen for the Jira event when a Sprint is started, and execute the rule
Branch Rule

The trigger Sprint Started does not present an issue list to subsequent actions. Therefore in order for the issue update action to target any issues, we specify the branch rules action to fetch Issues in the sprint

The rule restricted to projects setting minimises the number of issues being looked up for efficiency

Edit issue fields action

This action updates the Jira issues provided by the branch rule. While the target fields are not listed in the drop down, we leverage the additional fields section and Smart Values to update the sprint. Breaking down each smart value element:

  • issue  - the Jira issue
  • sprint  - looks up the "Sprint" field for that issue
  • last  - the latest sprint, required if the issue has been in multiple sprints in the past. The latest sprint will always be the active sprint unless the parallel sprints feature is enabled. This means that this solution will not work with parallel sprints turned on. If last  is omitted, the first sprint will be returned which is not desirable
  • startDate|endDate  - the sprint's start or end date
  • jiraDate  - transform the long style date provided by sprint into a short style date that the Advanced Roadmaps Target start | Target end fields can ingress. If not used, Unparseable date  error will be raised

Further reading


DescriptionHow to update a story's target start and end dates using Jira Automation
ProductAutomation for Jira
Last modified on Dec 28, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.