Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Store Active Sprint in New Field? Using Jira Automation, Script Runner, or Both? Edited

ABOUT

If you look at the way Jira stores sprint information you will soon see it's quite complicated. Jira likes to save all completed sprints as an array along with the current sprint information which makes it really hard to pull out that one specific value. I am close to making this happen with Jira Automation, however, it falls short in the scenario below. So I included Adaptavist as well to see if this is possible or how to go about it with Script-Runner (we own both products).

It is also a shame because at the moment {{issue.sprint.last}} works most of the time, but since sprints are served up based on ID and not sequence, the sprints don't always line up in the correct order for which they've been ran.

GOAL

To save the active sprint name value (or any part of the list, please make it flexible) into a new field.

EXAMPLE

Privacy information has been removed.

"customfield_10105": [
"com.atlassian.greenhopper.service.sprint.Sprint@4022a016[
id=3980,
rapidViewId=732,
state=CLOSED,
name=Sprint1 21.2.2 (4/29-5/19),
startDate=2021-04-29T10:19:00.000-05:00,
endDate=2021-05-19T10:19:00.000-05:00,
completeDate=2021-05-17T08:52:21.889-05:00,
activatedDate=2021-04-26T09:25:00.039-05:00,
sequence=3981,
goal=//,
autoStartStop=false]",
"com.atlassian.greenhopper.service.sprint.Sprint@61afd29b[
id=3981,
rapidViewId=732,
state=ACTIVE,
name=Sprint2 21.2.3 (5/20-6/9),
startDate=2021-05-20T10:19:00.000-05:00,
endDate=2021-06-09T10:19:00.000-05:00,
completeDate=<null>,
activatedDate=2021-05-17T09:07:27.256-05:00,
sequence=4000,
goal=//,
autoStartStop=false]",
"com.atlassian.greenhopper.service.sprint.Sprint@63b49544[
id=4321,
rapidViewId=732,
state=CLOSED,
name=Sprint3 21.2.1 (4/8-4/28),
startDate=2021-04-08T15:01:00.000-05:00,
endDate=2021-04-28T15:01:00.000-05:00,
completeDate=2021-04-26T08:57:23.922-05:00,
activatedDate=2021-04-08T13:33:06.126-05:00,
sequence=3980,
goal=//,
autoStartStop=false]"
],

THOUGHTS

In the example above you can see the second sprint in this list is actually the most current, the state is active, the sequence number is higher, the start and end dates are closer, but the ID seems to be determining the order (which does make sense to me). This might be more of an edge case where this person changed the name of a sprint and then ran them out of the order they were created in.

Even though this is an edge case (maybe) it is what I am currently dealing with, and we should be able to get that value without this much hassle. I look forward to the responses.

JIRA AUTOMATION

I currently have an IF-ELSE automation that looks to see if the sprint is empty, and if it is then it sets our custom field to backlog, same if the sprint not in openSprints() or futureSprints(). The last else just updates the field with {{issue.sprint.last}} and this mostly works except for most issues that have, "completed sprints" associated to them.

SCRIPT-RUNNER

I thought about building a listener or some type of script but honestly I have no idea where or how to even start, I'm not familiar with groovy or importing methods to use so a lot of help would be appreciated here.

3 answers

Bump to see if anyone has any ideas or help. :)

0 votes
wwalser Atlassian Team May 18, 2021

I've managed to accomplish this through some trail an error. It's not as flexible as you've requested, I'll leave that as an exercise for the reader.

The basic gist is to use a combination of smart value list interpolation and create variable action to print out and then extract the active sprint name. Grabbing any other value from the active sprint object would also be possible. Your question indicates that you know how to lookup the values within said object so I'll skip that explination.

Here are screenshots of what you want:

 

Create a variable to store the sprint names and state information as a string.Screen Shot 2021-05-19 at 11.20.48 am.pngLog our regular expression to be sure it extracts what we expect.

Screen Shot 2021-05-19 at 11.20.55 am.png

Create another variable with the extracted active sprint name as a string.Screen Shot 2021-05-19 at 11.21.01 am.png

Add a comment to an issue, just to be sure we can actually use this information in some meaningful way.Screen Shot 2021-05-19 at 11.21.07 am.png

A look at the resulting audit log.Screen Shot 2021-05-19 at 11.25.08 am.png

The comment was successfully added.

Screen Shot 2021-05-19 at 11.21.11 am.png

@wwalser thanks a bunch for that help, I really appreciate it. I think the only problem that I have here is since we're on Jira Data Center, our Jira Automation doesn't give me the option to create a variable (which is extremely unfortunate). 

Is this example you've typed up related to Cloud?

wwalser Atlassian Team May 19, 2021

Ah yes, very sorry about that. This will not work on server. Unfortunately I'm not sure you'll be able to accomplish this on Automation for Jira server.

No problem, thank you for your help! :)

Hi @Benjamin Dains 

How much scope change do you have during sprints?  If the answer is "none" or "not much", have you considered using the Sprint Started trigger, and saving that sprint value in your custom field?

If you have a lot of scope change, a messier solution would be to use a web request to call the REST API to get all of the issues in the sprint.  That seems a bit heavy to solve this problem.

Best regards,

Bill

Hi @Bill Sheboy !

Sorry for the long delay, we decided to turn off the automation since there really isn't a good way to get the value 100% of the time and was causing more confusion than value.

The scope does change often or else that does seem like a viable solution.

Thanks,
Ben

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you