[jjupin] How to loop through version specific issues?

I want to perform an action/change to all issues referenced in a specific version.

e.g. during a 'SIL Post-function Function' I want to set the value for a hidden custom field to a specific value, for all issues references in the version selected in a 'version-picker custom field'. For example, for all issues fixed in version "" I like to set the value of the custom field "check" to "true".

Could someone please help me with the correct syntax?

1 answer

1 accepted

2 votes
Accepted answer

Hi Lucas,

This can be achieved using the selectIssues routine that accepts a jql as parameter:

string[] issues = selectIssues("fixVersion =");
for(string iss in issues) {
%iss%.check = true;

Hi Elexandru, thank you very much! I am amased by the power of this addon.

Some remaining questions :)

I now have (which is not working):

string[] BaselineVersion = Baseline;
string[] issues = selectIssues(BaselineVersion);
for(string iss in issues) {
%iss%.Locked = "Yes";
  • "Baseline" is the name of the "Version picker" custom field
  • "Locked" is the name of the "Text field" custom field
  1. The value of the text field "Locked" is not set to "Yes". Could you explain what I do wrong?
  2. Could you provide an example of manipulating a 'Select List (single choice)' or a 'Radio Button' field, both have two values "Yes" and "No"

1. For the selectIssues routine you have to provide a jql as parameter (eg "Baseline = 4.1.0"). You forgot the "Baseline = " part. Notice also that the Baseline value must pe cast to string before using it in the jql. Just store it in a string variable and use that instead:

string BaselineVersion = Baseline;
string[] issues = selectIssues("Baseline = " + BaselineVersion);
for(string iss in issues) {
%iss%.Locked = "Yes";

2. Setting the value for a Select List or a Radio Button field isn't different from setting a value to a text field:

%iss%.SelectList = "Yes";

%iss%.Radio = "Yes";

Thanks you so much!

Could you please have another look at the code snippit, it is not working for me (Archiving works but changing the text value is not):

See screenshot below after pressing the "Lock Baseline" version. I hoped the value for the text field "Locked" was set to "Yes"

Try to put selectIssues("Baseline = '" + BaselineVersion + "'"). If the version name has more than one word, as in your case, it must be surrounded by quotes in the jql. Let me know if this solves your problem.

Works, you are a champ! Great tool and great support

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,715 views 17 21
Read article

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