Forums

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

Automatically Generate List of Fix Versions for the Current Month

Hunter1428
Contributor
February 21, 2024

Hi everyone,

I'm trying to generate a list using jira automatons of all the fix versions scheduled or have released in the current month.

  • JQL: fixVersion in releaseDate("after startOfMonth() before startOfMonth(1)")

Currently I'm using this below for now. Sadly it's producing duplicates as it's running on each issue.

  • {{#issues.fixVersions}} {{name}} {{/}}

Note: We have an older version of automatons on our instance, no lookup.

Is there a better way or a way to fix the duplicate issue I'm getting?

Thanks!

2 answers

1 accepted

0 votes
Answer accepted
Hunter1428
Contributor
June 11, 2024

Hello again!

So we finally moved to our new data centre and are now on version v9.12.7.

All the options you have given work so thank you for the help on these!

 

Quick question:
What would be the best way to put each value onto a new line or in a table format?

Tying to create a report like this within an email.

  • Released on 15th Dec - Version 1
  • Released on 18 Dec - Version 2
  • Released on 27 Dec - Version 3

 

I tried to generate a simple list but this keeps returning blank.

  • {{#issue.fixVersions}}name: {{name}}{{^last}}, {{/}}{ {/}}

I also tried this, but I only get the last version in my query. 

  • {{issue.fixVersions.name.join("\n• ")}}

 

Any ideas?

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.
June 11, 2024

Hi @Hunter1428 

As a reminder, I am using Jira Cloud, and not Data Center version, so please test any suggestions to confirm they work.

 

Just to confirm is this for a single issue as you are showing a prefix of {{issue... for the expressions?

 

First, try writing just the field to the log and observe what you get:

#1) just the version ids: {{issue.fixVersions}}

That should list the version ids as a CSV list.  If that works, try this one:

#2) just the version names: {{issue.fixVersions.name}}

If that works, try this one to iterate the values:

#3) version names iterated over: {{#issue.fixVersions.name}}{{.}}{{^last}}, {{/}}{{/}}

If it works, try adding your formatting.

Kind regards,
Bill

Hunter1428
Contributor
June 12, 2024

Hi Bill, thank you for the swift response!

My filter looks over many issues which are spread across multiple fix versions. Can confirm 4 fix versions are spread over the issues the filter finds.


I tried all the suggestions you said and here is the outcome.

  1.  Gave me the ID of 1 fix version (Most recent created)
  2.  Gave me the name of 1 fix version (Most recent created)
  3.  Same as point 2.

If I change issue to issues. I get the full list. But its just one long string which I'm unable to format into bullet points. Maybe I'm just dumb and expecting the "list" stuff to outcome something different then what it actually does.


Here is my automation layout just encase it's an issue with it.

image1.png

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.
June 13, 2024

The rule trigger you show has selected the bulk handling option, and so the smart value is the {{issues}} one used, and not {{issue}} and so I wonder if there is something different for that list of values (similar to the current Data Center limitations with Lookup Issues).

Again, I am using Cloud not Data Center, and so cannot check this...

Please try writing this to the log and test the rule:

List of counts: {{#issues}}{{key}}:{{fixVersions.size|0}}, {{/}}

That should produce a list of the keys and the number of fix versions in each issues.

 

Hunter1428
Contributor
June 14, 2024

Hi @Bill Sheboy

This does indeed produce a list you mention.

But I think I'm beginning to confuse you here in what I want haha.

Let me clean up and clarify what I'm looking for.

 


I'm looking to generate a report every month to show a list of all the versions we have released within the month and send it via email automatically. 

Something like this.

table1.PNG

I can do the HTML and CSS part but I'm struggling to get the data correct and in the right format.

 


So far this is very close to what I want. But I'm getting duplicated fix versions and I cannot format the date. I tried using distinct on the fixVersions but no affect and I also tried to use .format("d/MMM/yy")}} for the start and release date. But also no affect.

<table>
<tr>
<th>Version</th>
<th>Start Date</th>
<th>Release Date</th>
</tr>
{{#issues.fixVersions}}
<tr>
<td>{{name}}</td>
<td>{{startDate}}</td>
<td>{{releaseDate}}</td>
</tr>
{{/issues.fixVersions}}
</table>

 

Apologies on confusion and thanks again for all the help so far!

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.
June 14, 2024

For Jira Cloud, the one way I know how to do this is: merge the versions to a known delimited-format, split / distinct, and parse with match().

For example:

 

  • for all the issues, merge together all of the fix version data in a delimited, created variable
    • name: varAllFixVersions
    • smart value:
{{#issues.fixVersions}} name:{{name}};startDate:{{startDate.jiraDate}};releaseDate:{{releaseDate.jiraDate}}~~{{/}}
  • split the variable apart, using distinct to reduce it
{{varAllFixVersions.split("~~").distinct}}
  • use match() on the result to extract the parts
{{#varAllFixVersions.split("~~").distinct}} 
<tr>
<td>{{match("name:(.*);startDate:.*")}}</td>
<td>{{match(".*;startDate:(.*);releaseDate:.*")}}</td>
<td>{{match(".*;releaseDate:(.*)")}}</td>
</tr>
{{/}}

That last bit uses an interesting feature of iterators where unnamed list elements are normally referred to as {{.}} but that can be implied with the use of functions directly.

 

Please adjust accordingly to get your desired formatting and delimiters...subject to the names of your fix versions.

 

Hunter1428
Contributor
June 14, 2024

Urghhh absolute magician @Bill Sheboy 

I began going down the variable route also but the Match() stuff I would spent ages trying to understand. This provided a lot of useful info I can apply in other areas of things I'm working on.

Thank you so much for the help and have a great weekend!

Like Bill Sheboy likes this
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.
June 14, 2024

Awesome; I am glad to learn that helped!

0 votes
Kalyan Sattaluri
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 21, 2024

Hello @Hunter1428 

Please try {{issues.fixVersions.name.distinct}}

BTW - Make sure you have below checkbox selected on your scheduled trigger page.. image.png

Hunter1428
Contributor
February 21, 2024

Hi @Kalyan Sattaluri

Thanks for assisting!

I tried what you suggested but unfortunately this produces.

  • [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []


I also tried both below but they produced a blank output.

  • {{#issues.fixVersions.distinct}} {{name}} {{/}}
  • {{#issues.fixVersions}} {{name.distinct}} {{/}}

 

Kalyan Sattaluri
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 21, 2024

Please log below 2 smart values in the below order (as shown below) and share similar screenshot which shows your audit log.

  • {{issues.fixVersions.name.distinct}}
  • {{issues.fixVersions}}

Also, make sure you have checked the box as mentioned in my original post.

BTW - The other smart values you have listed are not correct syntax so blank is expected.

 

 

Hunter1428
Contributor
February 21, 2024

I copied yours to see if it was some issue with the branch. But still have the same issue.
Double checked and check box "trigger in bulk" is indeed checked.

image1.png

Kalyan Sattaluri
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 21, 2024

 I am stumped, LOL.

Could you log {{issues.fixVersions.id.distinct}} instead just to try.

Hunter1428
Contributor
February 21, 2024

Same here haha.

Sadly still the same issue.
image2.JPG

I wonder if it's a bug in an older version of jira automation?

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.
February 21, 2024

Hi @Hunter1428 and @Kalyan Sattaluri 

FYI, I am using Jira Cloud, not Data Center, and so cannot test what I suggest.  With that out of the way...

Too bad your instance does not have the automation version with Lookup Issues, as perhaps there is some differences in behavior with bulk-handling and the {{issues}} smart value.

I would expect {{issues.fixVersions.distinct}} to contain arrays, possibly with repeats of the same version.  The reason why is if any issues were ever in multiple releases (e.g, A, B, C) then that set would be treated as a distinct value rather than each release.

 

Have you tried flattening the results out first, perhaps like this:

{{issues.fixVersions.name.join(",").remove("[").remove("]").replace(", ",",").split(",").distinct}}

That would join everything, removing any array handling, and then split back into a list before the distinct attempt.  Please note, I may have some missing spaces for the array removal, so try logging that and making adjustments, as needed.

Kind regards,
Bill

 

UPDATE: I tweaked it a bit after testing :^)

 

Kalyan Sattaluri
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 21, 2024

Just strange.  I would guess that .distinct would work..

You could make a REST API call to get the version list of your project and find versions with release date in current month... but its a lot of work..

1 last one, does {{issues.reporter.distinct}} work?

 

Hunter1428
Contributor
February 21, 2024

Hi @Bill Sheboy

Thanks for also assisting!

Unfortunately both suggestions result in emptiness.

image3.JPG

I'm going to have a chat with some of our IT guys to see if we can get some updates. As building a REST API call just for this is like said a lot of work. It seems we just have an old version which either contains bugs or does not have these things fully implemented.

If i managed to get an update I will try again and report back!

Any other ideas come to mind please throw them over and I will indeed give them a try.

Thanks for the help regardless :)

Like Bill Sheboy likes this
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.
February 21, 2024

Did you try my updated expression, as I found a mistake in the one you are showing which uses replace() rather than remove() for the array brackets...and removes extra spaces resulting from the join()?

{{issues.fixVersions.name.join(",").remove("[").remove("]").replace(", ",",").split(",").distinct}}

 

Did you also see the suggestion from  @Kalyan Sattaluri to confirm the bulk-handling option is selected for the trigger?  Otherwise the {{issues}} smart value will be empty.

Like Kalyan Sattaluri likes this
Kalyan Sattaluri
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 21, 2024

@Hunter1428 

Maybe you should check with your internal Jira Admin team on the version you guys are currently on..

Cause I spent some time digging into DC edition release notes and found this blurb in July's 2023 release notes:

https://confluence.atlassian.com/automation/jira-automation-release-notes-1018767858.html#:~:text=Added%20the%C2%A0smart%20value%C2%A0list.distinct%C2%A0to%20CollectionWrapper

I would have expected more documentation on what that means but no such luck.

My guess is, maybe you guys have an Automation version which is older than 8.2.2 and so this .distinct operation is not working.

You should def advocate to upgrade to latest, the latest edition has lookupIssues and create variables which are very useful otherwise.

 

Like # people like this
Hunter1428
Contributor
February 22, 2024

@Bill Sheboy Yup "bulk-handling option is selected for the trigger" is 100% ticked. Your updated expression also produced a blank output.

@Kalyan Sattaluri Our instances is running on 7.7.2. I assume this is the problem. Thanks for taking a dig into documentation!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer