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

Laurence Wu November 10, 2017

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
Justin Evans
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 13, 2017

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!

Laurence Wu November 14, 2017

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?

Justin Evans
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 14, 2017

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;
Laurence Wu November 15, 2017

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.


1 vote
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 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

Laurence Wu November 13, 2017

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

Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 13, 2017

You can start from 2 point, 

from automation lite for jira plugin.

0 votes
Laurence Wu November 15, 2017

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 Sign up to answer