So I have a large project with some teams working in Fix Versions and some in Sprints. It's not best practice but I've been asked, to smooth teams filling out too many fields when entering tasks to automate filling in fix versions when an issue is added to or makes changes to a sprint.
Trigger:
When: Value changes for Sprint
Conditions:
Sprint is not empty
Other conditions
Create Variable: varLastSprint {{issue.sprint.last.name}}
So I can get the name of the sprint which is last in the order fine (maybe some edge cases with this in the long run if things have multiple sprints assigned if the sprint has closed, but can probably sort these later)
The Fix Versions are named in this format "AB N" - e.g. "AB 1"
The sprint name format is "AB N Sprint N" - e.g. "AB 1 Sprint 2"
My current strategy is to grab varLastSprint smart value and somehow strip up to the space before the sprint x to just leave me with the "xx 1". A couple of hours of playing around with smart values has got me to here:
{{varLastSprint.split(" ")[0]}} {{varLastSprint.split(" ")[1]}}
However I don't think this is working and is erroring when I'm testing it.
Any strategies and suggestions would be most welcome.
Thanks
Hi @Sandy King
For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!
Until we see those...
Is your plan to create a new version, based on the sprint name?
If so, I recommend triggering the rule on Sprint Started. That will both ensure you know the correct sprint name to use for the version creation, and the correct issues to assign to the version.
Next, I recommend using the text functions, such as the substring ones, rather than split(), as that will be easier with your scenario. For example, the {{sprint}} smart value is the one associated with the trigger Sprint Started, and so:
{{sprint.name.substringBefore("Sprint").trim()}}
This would extract the planned version name from the sprint name.
Please look here to learn more about the text functions for smart values: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/
Kind regards,
Bill
Hi Bill,
The plan is not to create a Fix Version, just to update the fix version to the sprint that fits within it.
JIRA obviously doesn't know that our sprints fit within releases. e.g. per release we have two sprints.
Release = AB 1
Sprints within that release = AB 1 Sprint 1, AB 1 Sprint 2
As I have some teams working Scrum in Sprints and some working Kanban in releases, we still want to provide a holistic reporting based on Releases to Stakeholders so want when tickets are added to sprints they also align with a release.
My hope is that if we are strict with our naming conventions, this automation should stand the test of time...
If I used:: {{issue.sprint.name.substringBefore(" Sprint").trim()}} that looks like it may work? It should also accommodate if the milestone naming convention changes
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.
Well done, and I am glad to learn that worked!
I would caution it will not work when issues have been in multiple sprints.
If the sprint is active / in progress, it is possible to filter the list to get only the active one for your value. For example:
{{#issue.sprint}}{{#if(equals(state,"active"))}}{{name.substringBefore(" Sprint").trim()}}{{/}}{{/}}
This will iterate over the sprint values in the issue, filtering to find the active sprint, and then extract the value from the name (as you have shown).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah I was just being a bit lazy and assuming it would be the last in the list of sprints as if a ticket was moved forward on sprint closed it would be the next in the line of values and the field can only hold one non closed sprint is my thinking (I may be wrong)
{{issue.sprint.last.name.substringBefore(" Sprint").trim()}}
I don't necessarily want it to occur on active sprints as we may be planning sprints ahead
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha, and well done!
I have not found in the documentation the defined order of sprint values when issues carryover. Other questions have successfully used last as you are doing, so the only watch item may be edge cases:
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.