Hello
we are using the jira field "fix version/s" in our configuration.
Based on the the dates from the releases, we want to calculate the CW of the given date.
This works fine, when we use a custom field to choose the release, but with the fix version/s we do not know how to get the value from the field.
I hope someone has an idea for that issue.
Hello,
You can get a value from Fix Versions like this:
issue.getFixVersions()
Hi,
issue.getFixVersions()
returns a "Collection" and out of this collection I don't know which is the selected value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It returns you the collection of selected FixVersions. You can select multiple fix versions in this field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I try it like theese:
def list = issue.getFixVersions();
def Date2 = list[0];
print Date2.getReleaseDate();
def test = new Date(Date2.getReleaseDate().getTime());
return test;
The date of the release is "23/Apr/19" but I get this "Mon Apr 22 00:00:00 CEST 2019"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You need to format the date like this:
import java.text.SimpleDateFormat
def list = issue.getFixVersions();
def Date2 = list[0];
print Date2.getReleaseDate();
def test = new Date(Date2.getReleaseDate().getTime());SimpleDateFormat dt = new SimpleDateFormat("yyyyy-mm-dd hh:mm:ss");
return dt.parse(test);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This looks good, but the dt.parse(test) does not work. The MEthod is not able to parse Date.
Maybe there is another way?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this one:
import java.text.SimpleDateFormat
def list = issue.getFixVersions();
def Date2 = list[0];
print Date2.getReleaseDate();
def test = new Date(Date2.getReleaseDate().getTime());SimpleDateFormat dt = new SimpleDateFormat("yyyyy-mm-dd hh:mm:ss");
return dt.format(test);
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.
If my answer helped you, kindly accept my answer.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With JCMF misc custom fields I ended up with a solution like this, taking into account there might be multiple fixversions in each issue.
Last release date (null and thus field not shown if empty)
def version = issue.getFixVersions();
def releasedates = [];
version.eachWithIndex { it, i -> // `it` is the current element, while `i` is the index
releasedates.add(it.getReleaseDate().format("yyyy-MM-dd"))
}
return releasedates.max();
First start date (null and thus field not shown if empty)
def version = issue.getFixVersions();
def startdates = [];
version.eachWithIndex { it, i -> // `it` is the current element, while `i` is the index
startdates.add(it.getStartDate().format("yyyy-MM-dd"))
}
return startdates.min();
Should also be easy enough to modify to support datetimefield type if needed, we just needed plain datestamp here.
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.