The builtin "Affects Version" field will display "None" when it is EMPTY.
I've successfully created a Scripted Custom Field called "Released Fix Versions" that will display the values in FixVersions that are marked released (this is to help users to see which fixVersions should be available to them without having to understand how Jira tracks releases).
I have the following code:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.VersionManager
import com.atlassian.jira.project.version.Version
import java.util.Collection
Collection<Version> releasedFixVersions = []
for (i in issue.fixVersions) {
if (i.isReleased()) {
releasedFixVersions.add(i)
}
}
return releasedFixVersions
This seems to be working great. I get a nicely formatted list of version links when there is at least one released FixVersion. However, when there aren't any released FixVersions, the field is displayed as just empty. I'd prefer that it display 'None'. I played around with returning different things when the list is empty, like:
return releasedFixVersions ? releasedFixVersions : null // same whitespace behavior
return releasedFixVersions ? releasedFixVersions : ["None"] // same whitespace behavior
return releasedFixVersions ? releasedFixVersions : ["None" as Version] // error about not being able to coerce String into Version... okay, that's reasonable
Is there some magic I can return that will get the "Version Picker" template to display "None"? Please include a pointer into where the "Version Picker" template is in the Jira source if you know.
Thanks!