You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I am working on a Jira Cloud instance, and I would like to be able to assign a Sprint to a created Epic automatically. This would be done by comparing the Due Date of the created Epic with the dates of active and future sprints. The correct Sprint will be chosen if the Due Date of the Epic is between the Start Date and End Date of the Sprint.
The Epic, when created, already has a Due Date. I want to avoid manually editing the Sprint field to fit the Due Date.
I have tried using both Jira Automation and JMWE to automate this but to no avail. I am unsure if there is a way to do this with these apps ?
Thank you for your help,
Hi @Guillaume Govers -- Welcome to the Atlassian Community!
First thing, what problem are you trying to solve by doing this?
I wonder because epics are typically not assigned to sprints as they are larger work items, taking multiple sprints to complete, and so their child issues are assigned to sprints.
Regarding your use case and question, this might be possible, by either...
Hey @Bill Sheboy
I appreciate that the way we use Epics is not the typical one. We are a non-dev team and an Epic is equal to an analysis that should be produced during a Sprint. This Epic has associated tasks (and not stories as seems to be the norm) that divide the work up. In the majority of the cases the Epic and related tasks will all be done in one sprint.
We have an integrated system where an external app automatically creates Epics with a populated Due Date. The idea is that instead of manually assigning these Epics to our Sprints this would be done automatically.
1. Not sure I understand your suggestion. Would Sprint names look something like this?
"Sprint XXX: ##Start Date##;##End Date##" Sprint 34:22/08/22;10/09/22
Would I then use the Smart Values in Jira Automation to deduce the dates of a Spriint from its title ?
2. I have never used the REST API but have been wondering if this would be required here. Would you happen to have an example of a similar API that I could base myself on?
Thanks for your help,
For method #1: yes, I was suggesting a structured sprint name that could be created only using the date (and not necessarily the number). Let's say you pick an anchor starting date of 1 Jan 2022, and have 2 week sprints. You should be able to determine the correct sprint based upon the due date by rounding up to the next whole 2 week increment.
For the REST API usage (for #1 or #2), here is a great how-to article showing how to call such methods:
And the specific method you want is to get all the sprints for a board:
Hello, again @Bill Sheboy
I have managed to configure two web requests with the Rest API.
The first one is a GET that returns all the sprints of my board, as you suggested.
The second one is a PUT that edits the sprint field of my trigger issue.
These two seem to work fine after some back and forth.
However, I still can't seem to find a way to differentiate sprints depending on the due date of the trigger issue. I have tried using the Jira Automation conditions to no avail. I have also tried using the Due Date smart value in the JSON of the web request, but they do not seem compatible.
To my understanding, with the smart values, I should be able to access the start date of all sprints from my first web request and compare them to the due date. Or could I add an "if" function in the payload of my web request? It is still unclear to me how to achieve this distinction based on the due date.
Thank you for your help already, feeling quite proud to have used the REST API for the first time :)
I believe you can do this with smart value list filtering: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588
For your web request response to gather all of the sprints, use the issue's due date and find the one where the due date is within the sprint's data range. Then use that sprint name (or id) as needed.
Hello @Bill Sheboy
Have been dabbling in this, however every time I seem to have a smart value filter that should work I seem to get this error message:
"Error invoking method com.codebarrel.automation.api.component.smartvalues.objectwrappers.CollectionWrapper.Element.get(java.lang.String@2061000330) on com.codebarrel.automation.api.component.smartvalues.objectwrappers.CollectionWrapper.Element@1007599544:"
I am not sure how to solve it. I have found some similar errors that seem related to the use of plug-ins. This does not seem to apply here as I am using only classic Jira fields ?
I would appreciate any insight you have here. Thank you for your help,
Perhaps the structure of the response does not match what you expect. Please first try running that REST API request by just pasting the URL into a browser. Then review the resulting response message to confirm you are getting the correct smart value layout.
UPDATE: After I experimented with this, I do not believe this can work with smart value, list filtering. Sorry for the bad solution idea.
First, the endDate value from the response needs to be converted from Text to a Date type for comparisons, leading to an expression like this:
Unfortunately...issue fields (and created variables) cannot be used inside of a function, which is inside of an iterator. Atlassian has already marked this defect as "Won't fix": https://codebarrel.atlassian.net/browse/AUT-2430
I also tried other functions instead of isAfter() and they were of no help. The problem seems again related to trying to do this in the filter.
Thank you for your answers. I went with a simpler solution that requires the date of the next sprints to be added manually to the automation rule every few months. This won't be completely automatic but should work well enough for my use-case.
Thank you so much for your help and guidance,