issuefieldmatch - Affects Version/s field

Marc Minten _EVS_
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 4, 2014

What name to be used for the field "Affects Version/s" in the scrip runner issueFieldMatch function (2nd argument) ?

For the "Fix Version/s" field it works with "fixVersions" : with or without quotes, but case sensitive. Any other name does not work.

For the "Afefcts version/s" i tried any name variation I could imagine, but never got any results... sad

3 answers

0 votes
Deleted user March 25, 2018

Did you find the solution?

 

I am trying to use the Affects Version/s field in script validator and I receive this error:

"could not look up the type for this custom field, so we can't check this code.

possibly the field doesn't exist"

 

this is the script:

cfValues["Fixed in version/s"].toSet() == 'null' || cfValues["Versions"].toSet()

 

what I am trying to get is that "Fixed in version/s" can't filed as long as the "Affects Version/s" field is empty

 

Thanks !

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 25, 2018

It is not a custom field, it's a system field, so it's directly attached to the issue.

Try issue.getAffectedVersions()

Deleted user March 25, 2018

Thanks !

0 votes
Marc Minten _EVS_
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 4, 2014

This was one of the many many names i tried, ... no results:

 issueFunction in issueFieldMatch("project=xed", fixVersions, ".*") returns all issues with a fix version

 issueFunction in issueFieldMatch("project=xed", affectedVersion, ".*") does not returns anything.

I also tried affectedVersions, AffectedVersion, affectsVersion, affectsVserions, version, versions, .... and hundreds of other combinations. Never got any result...

Udo Brand
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 4, 2014

Strange since this works (and should give also your wanted result) project =xed and affectedVersion is not empty

Marc Minten _EVS_
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 4, 2014

Hi Udo, what do you mean with "this works" ? You are getting results ? We are using Jira 6.1.6 and Script Runner 2.1.16 In the logging I find {code} 2014-11-05 11:33:50,234 http-bio-8080-exec-3 DEBUG [jira.groovy.jql.AbstractScriptedJqlFunction] Subquery (project=xed) took 15 ms 2014-11-05 11:33:50,234 http-bio-8080-exec-3 INFO [jira.groovy.jql.AbstractScriptedJqlFunction] Could not find field affectedVersion on issue DocumentIssueImpl[issueKey=XED-390] 2014-11-05 11:33:50,234 http-bio-8080-exec-3 INFO [jira.groovy.jql.AbstractScriptedJqlFunction] Could not find field affectedVersion on issue DocumentIssueImpl[issueKey=XED-389] ... {code} The issues XED-390 and XED-389 have field "Affects Version/s" filled in...

Udo Brand
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 4, 2014

The query project =xed and affectedVersion is not empty (with a diferent project key) works on my side. so in JQL it is affectedVersion. Do use see those two issues if you run my query?

Udo Brand
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 4, 2014

Sorry for the typo, I mean "do you see..."

Marc Minten _EVS_
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 5, 2014

Hi Udo, Yes, the JQL query works fine, but I think this does not proof the name "affectedVersion" also works in the issueFieldMatch function :-( . That's the core of my problem... Take the example of the fixVersion field: in a JQL query you have to use the name "fixVersion", in the issueFieldMatch the name of the field seems to be "fixVersions" (with an extra "s" at the end). The name "fixVersion" does NOT work in the issueFieldMatch function neither! I have no idea where the field names to be used in the issueFieldMatch come from...:-(

JamieA
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 6, 2014

The field ID for "Affects Version/s" is "versions". The value compared is the list toString'd, so an empty list of Affects Versions will be []. Therefore .* will have to match everything. What is the query you are trying to do?

Like Mikko Pekkanen likes this
Marc Minten _EVS_
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 6, 2014

Hi Jamie,My query : project = xed AND issueFunction in issueFieldMatch("project=xed", version, ".*") I think we are getting closer. When I use "versions" (with or without quotes) as second argument, I get a red box with error "Error occurred communicating with the server. Please reload the page and try again". No errors in the log file. Any other name (for example "version" (without "s") just returns "No issues where found to match your search". And for every issue matching "project=xed" an error in the log file : http-bio-8080-exec-14 INFO [jira.groovy.jql.AbstractScriptedJqlFunction] Could not find field version on issue DocumentIssueImpl[issueKey=XED-1] Hope this helps, thanks for your help!

Marc Minten _EVS_
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 6, 2014

.... my query should read of course as project = xed AND issueFunction in issueFieldMatch("project=xed", versions, ".*") (with the "s" after versions)

0 votes
Udo Brand
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 4, 2014

try "affectedVersion"

Suggest an answer

Log in or Sign up to answer