How to update a story's target start and end dates based on the sprint dates using Jira Automation
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 trigger | Automation 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:
|