Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

User story version dates

Leonardo Zevallos Guzman
Contributor
November 26, 2023

Hello community, I need help with an automation.

I want the "Start Date" and "Publication Date" to be set to version "x":

Fecha version.png

It is copied into the "Target Stat" and "Target end" fields respectively in the user stories that belong to version "x"
Fechas HU.png

1 answer

0 votes
Mykenna Cepek
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.
November 28, 2023

I'm using Jira Data Center, so I can't give you a Jira Cloud tested solution. But here's how I would approach this...

Start by querying the Jira API from your browser to see what the attributes are, and are named, for project Versions (aka Releases). Be logged into Jira in the browser. In Jira Data Center, this URL would do it:

https://jira.COMPANY.com/rest/api/latest/project/PROJKEY/versions

where you replace COMPANY and PROJKEY as appropriate. For Jira Cloud, the domain part will likely be something like COMPANY.atlassian.net instead.

You should get JSON returned showing all the Versions defined for the Project, and the attributes Jira has for each Version. Tip: Firefox formats the JSON nicely. Match up the curly braces to find just the first Version in the list, and identify the attribute names and values, noting the data types and formatting for the values of interest.

You can then experiment in Jira Automation with smart values like {{issue.fixVersion.first.releaseDate}} on an issue which has a FixVersion set. Start with a simple rule that just triggers on a change to the FixVersion field, and uses the "Log Action" to output the SmartValue. If you get nothing from the Smart Value, check your syntax and experiment.

Note that the FixVersion field is a list, which complicates the Smart Value slightly. The documentation on Smart Value lists is good. However, ask yourself: if there are multiple Versions listed in the FixVersion field, which one will you use? You likely cannot trust that they are in any certain order.

I wasn't able to access Version attributes in a Jira automation rule this way (Data Center limitation?), but maybe it'll work for you in Jira Cloud. From the documentation, I doubt it. But it's worth a try, because this would the easiest solution for you.

- - - - - - - 

If it doesn't work, then your only option is to retrieve the Version data from the Jira REST API in your automation rule (or do this another way outside of Jira automation). I've done this kind of thing, but it's a huge hassle. You have to create a Personal Access Token (PAT), and use it to make Jira REST API calls in your rule to retrieve the results.

WARNING:  PATs in rules can be a security risk if you haven't locked down who has access to your project's automation rules.

The documentation on PAT creation is good. Authenticating from a rule to the REST API is tricky; search the community here for examples. Take it a step at a time in your rule.

For a specific issue, you can query the Jira REST API for the FixVersions on that issue:

https://jira.Company.com/rest/api/latest/issue/SAMP-345?fields=fixVersions

This returned JSON like the following:

{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations","id":"463750","self":"https://jira.COMPANY.com/rest/api/latest/issue/463750","key":"SAMP-345","fields":{"fixVersions":[{"self":"https://jira.COMPANY.com/rest/api/2/version/25494","id":"25494","description":"Example release","name":"Release 1.1.1","archived":false,"released":false,"releaseDate":"2023-12-15"}]}}

I notice that the Version StartDate is not listed here, but you do get the Version id. You can look up a specific Version:

https://jira.COMPANY.com/rest/api/latest/version/25494

...which returns all the data available, including startDate:

{"self":"https://jira.COMPANY.com/rest/api/2/version/25494","id":"25494","description":"Example release","name":"Release 1.1.1","archived":false,"released":false,"startDate":"2023-11-28","releaseDate":"2023-12-15","overdue":false,"userStartDate":"28/Nov/23","userReleaseDate":"15/Dec/23","projectId":14606}

This is very complicated stuff in Jira Automation - quite advanced. If you don't feel up to it, that's ok -- but then the final answer is:  Jira Automation isn't mature enough yet to make this easy.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events