Hello,
Using the JIRA Misc Custom Field add-on, I would like to create a new field that returns "1" if the sprint of an issue is active, or "0" if it is anything else than active.
This is what I tried but it's not working:
<!-- @@Formula: String sprintState = issue.get("customfield_10005").getState().toString(); if (sprintState.equals("Active")) { return "1"; } else { return "0"; } -->
by sprint state I am referring to the "ACTIVE" state in the sprint properties':
com.atlassian.greenhopper.service.sprint.Sprint@4441e895[id=9153,rapidViewId=2963,state=ACTIVE,name=team1 test sprint,startDate=2019-05-07T00:00:07.164+02:00,endDate=2019-05-21T00:00:00.000+02:00,completeDate=,sequence=9153,goal=]
Thank you!
issue.get("Sprint") actually returns a collection of Sprints: the active Sprint, plus all the closed Sprints the issue potentially belonged to before. To get the active sprint, use:
issue.get("Sprint")?.find{it.active}
For your need, it then becomes:
return issue.get("Sprint")?.find{it.active} ? 1 : 0
However, this code requires JMCF 2.0 or better.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.