I am trying to create a custom field, to compare the values of my second unreleased version and the current issue's fix version, however when I try to create a custom field that returns the value of the second unreleased version, it works in Groovy Script Tester (JMWE), but not when I try to use it as a custom field (JMCF). Here is the script:
<!-- @@Formula:
issue.getAvailableOptions("versions").findAll{version -> ! version.released} .getAt(1).name -->
As other people already answered, JMCF 1.x indeed uses BeanShell, not Groovy. Also, the getAvailableOptions method is not available in JMCF 1.x.
JMCF 2.0 will change all this, but it's still a couple of months away.
In the meantime, try this:
<!-- @@Formula:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.project.version.Version;
import com.atlassian.jira.project.version.VersionManager;
VersionManager versionManager = ComponentAccessor.getVersionManager();
versions = versionManager.getVersionsUnreleased(issue.get("project").getId(), false);
if (versions.size() < 2)
return null;
return versions.get(1).name;
-->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wonder if it's possible to do the same with Jira Misc Custom Fields plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am not sure, I was always under the impression that it could only evaluate java expressions / @@Formuls with Beanshell syntax.
I would wait for someone with more experience to chime in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I researched further, and turns out yes.
JMCF is using Beanshell, however there isn't a big community for JMCF's Beanshell use. I hope someone here can help me with converting the script or telling me what I can expect from Beanshell and hat I shouldn't.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would open a support ticket and hope that the folks at JMCF are nice enough to offer a resolution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.