[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

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 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,006 views 12 18
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