Hi,
I'm trying to find the best way to find the min and max dates of two custom fields of a group of stories related to an epic. We have two custom fields that we would like to get the earliest date and the latest date of and have the scripted field update in the epic it is related to. Any references/thoughts/suggestions of a ScriptRunner flow that would assist with that task?
Thanks in advance!
Hey James!
So, to clarify, are you saying that you want to pull two custom field values from an epic (which both consist of a list of stories related to that epic), and then, for each custom field, get the stories with the minimum and maximum dates? Then, once you find those, you want to output those stories to a script field? Additionally, what are the dates that you're referring to? Resolution dates, creation dates, etc...?
I can give you a better answer after you confirm the above, but conceptually, in a script field you could grab the values from those custom fields (assuming they are issue keys or something), get their associated issues, loop through the issues, and then do some sort of comparison using the java built-ins for Date objects: Date.before(Date), Date.after(Date), etc... While looping through, you could store the issues with the lowest and highest dates in variables to be returned later.
Again, I could probably code something up as an example after you answer those questions!
Thanks!
Aidan
Hi Aidan,
thank you you for the quick reply! I would like to roll up max and min dates of target dates of the stories that are associated to an Epic. So I would like to get the stories of an epic and then find all of the results of a custom date field to find the max or min to update a scripted field in the Epic. Let me know if that clears things up. Thank you again!
No problem!
So you're getting all of the stories of an epic, and for each of those stories you're getting the values from one of their custom date fields. From those values you want to find the max and min. Then you want to use that collection of maximums and minimums in some way to update the script field of the epic. Correct?
In what way do you plan on using those maximum and minimum dates to update the epic's field?
OOOOH or are you saying that each of the stories has a custom date field with a single value, and you want to collect all of those values from every story and find the max and min out of those?
Sorry I'm questioning so much. I'm just trying to wrap my head around the scenario haha.
@Aidan Derossett [Adaptavist] Hi Aidan, I have a similar query , can you please help.
My scenario is, I want to have a scripted field in PROGRAM EPIC. So what this field should basically do is, it must automatically pick the most late date based off the "DUE DATE" field in the EPIC.
Example: If
ABC EPIC-1 DUE DATE is 08/10/18ABC EPIC-2 DUE DATE is 10/10/18ABC EPIC-3 DUE DATE is 12/10/18
ABC PROGRAM EPIC scripted DATE field should automatically pick 12/10/18
It looks like you're new here. Sign in or register to get started.