How to pull "Fix Version/s" from a linked ticket?

Hello,

I want to be able to automatically populate the fix version in a ticket, where the fix version is sourced from the linked ticket.

Given I have Ticket 1A and I have a ticket linked to it, let's say Ticket 1B. Is it possible to automatically pull the Fix version from Ticket 1B and copy it on to Ticket 1A once it is filled out in Ticket 1B for example? 

And if so, Is it possible to also pull from multiple linked tickets? Pull Fix Version/s from Ticket 1B, 1C, 1D, 1E and copy to Ticket 1A. 

Thanks, 

3 answers

1 vote
Gonchik Tsymzhitov Community Champion Nov 11, 2017

Hi! 

it is possible. 

1. You need write a grovyy script like this

https://community.atlassian.com/t5/Answers-Developer-Questions/script-that-copies-the-Fix-Version-s-field/qaq-p/548550

 

How faster do you prefer? see fix version? (like listener you need it. or service)https://scriptrunner.adaptavist.com/4.3.5/jira/listeners.html#_add_watcher

 

2. Possible another solution: it will based on automation lite for jira

https://marketplace.atlassian.com/plugins/com.atlassian.plugin.automation.jira-automation-plugin/server/overview

 

Just you need understand which direction of link is main, the create a jql function and create listener or service for copy fix version value from one issue to another.

 

3. Possible solution it will based on other plugin: please, read below

https://community.atlassian.com/t5/Jira-questions/Copy-field-from-parent-to-sub-task/qaq-p/391863

 

4. you can write a some SIL script

 

5. Possible solution it is JS script you can include it using this plugin

https://marketplace.atlassian.com/plugins/ru.mail.jira.plugins.jsincluder/server/overview

 

Cheers,

Gonchik Tsymzhitov

Thanks for the prompt reply! Which option would require less development work?

Gonchik Tsymzhitov Community Champion Nov 13, 2017

You can start from 2 point, 

from automation lite for jira plugin.

1 vote

For Gonchik's "Option #4", this is the SIL script you would use. (Power Scripts for Jira must be installed).

/* This script will scan all issue links of a given
issue, grab the fixVersions of the linked issue, and
append those fixVersions to the given issue.
*/

string [] allLinkedIssues = linkedIssues(key);
for(string issue in allLinkedIssues) {
fixVersions = arraysConcat(fixVersions, %issue%.fixVersions);
}

You could then configure it so this script will pull in linked issue fixVersions on a workflow post-function or on an issue created / edited event listener. If you wanted to _push_ changes when a version is populated, it would be a little different.

/* This script will take the fixVersion/s of a given issue
and apply the same fixVersion/s to all linked issues.
*/

string [] allLinkedIssues = linkedIssues(key);
for(string issue in allLinkedIssues) {
%issue%.fixVersions = arraysConcat(%issue%.fixVersions, fixVersions);
}

You'd then probably trigger this script from an issue created / edited event.

Hope this helps!

Hello Justin, thanks for the reply!

Another issue is the linked issue would not have the fix version until later on in the workflow for the original ticket.

Would this script continually listen and pull in the fix version when it gets filled in in any of the linked tickets? Or only when the post function triggers this script?

It sounds like you'd want to push the fixVersion changes out to all linked issues when the fixVersion field is modified. For this use case, you would use the second script above. You would then trigger the script on an "Issue Updated" event. Of course, you'd probably want to limit the scope of the script to a single project so it's not running for all projects. You could further limit by issue type or any other criteria.

if(project=="PROJ") {
string
[] allLinkedIssues = linkedIssues(key);
for(string issue in allLinkedIssues) {
%issue%.fixVersions = arraysConcat(%issue%.fixVersions, fixVersions);
}
}

 This will append the latest fixVersion to all linked issues of the issue that was updated. If you want to synchronize fixVersions instead of appending, you could replace line #4 with:

%issue%.fixVersions = fixVersions;

Thank you again Justin! This clears up a lot of the logic behind it. I will try this method as well as the Scriptrunner Method.


Do you know how I am able to pull in Fix version/s from linked issue(s) using script runner? It would only pull in the fix version when the linked issue(s) has updated the fix version field. This would apply within 1 project, and one specfiic issue type. How would I go about doing this? @Nic Brough [Adaptavist] 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,224 views 14 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot