We want to trigger a slack massage if an issue is either removed or added to the current sprint with automation for JIRA. How would I go about implementing this?
Especially I am unsure how to check if an issue was removed from the currently active sprint.
This is what I setup,
We only wanted to be notified for non-sub-tasks when new issues left or came in on the current open sprints
Hey @Pierre Liddle hope you are fine!
I'm trying to follow your automation, but I'm struggling to make it work properly.
I was able to 'half do' it. I'm getting notified when issues are being removed from the current sprint. However, I'm ALSO being notified when issues are being moved between future sprints, and I'm not being able to prevent that in the rules.
Would you be able to help me out here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Lucas Ferreira I'm not sure if this would help, but I'm showing the one extra condition in the flow that wasn't in the previous screenshot. I can't recall why, but I see we turned this off, and it might be related to the issue you're describing.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AFAIK, "{{opensprints()}}" returns null (or EMPTY). There is no opensprints function in Smart Value.
We can use a smart value inside a JQL search, but I believe we can't call a JQL function inside a smart value tag as of today.
Therefore, the logic presented will work the same if you replace "{{opensprints()}}" with EMPTY. We can verify this by displaying the "{{opensprints()" in the A4J audit log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have 3 scenarios:
A. an issue move from an active sprint to a future sprint
B. an issue move from a future sprint, into an active sprint
C. an issue move from a future sprint, to another future sprint
I used 3 branches, one for each scenario.
For scenario A - I just used JQL condition:
sprint in openSprints() AND issue = {{issue.key}}
Then add Jira comment or send an notification saying this issue moved from a future sprint to an active sprint.
For scenario B - I used JQL condition:
sprint not in openSprints() AND issue = {{issue.key}}
And then I used compare two {{smart values}} condition, NOTE: I needed to use "contains" rather than "equals". I guess Atlassian did some changes and "contains" no longer works.
Checks if: {{fieldChange.from}} contains {{opensprints()}}
Then add Jira comment or send an notification saying this issue moved from an active sprint to a future sprint
For scenario C - I used a similar JQL condition and smart value comparison condition like in scenario B:
sprint not in openSprints() AND issue = {{issue.key}}
Checks if: {{fieldChange.from}} does not contain {{opensprints()}}
Then add Jira comment saying this issue moved from one future sprint to another future sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi James,
Thanks for posting a solution. I noticed a few issues below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
While not simple to follow, this should help - https://confluence.atlassian.com/automationkb/send-notification-when-an-issue-is-added-or-removed-from-a-sprint-1333986992.html
If you're on Jira cloud, download and import the json file at the end of the article, and tweak as required
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.
This is a few years late, but I have a solution that works. It is tested in Jira 8.20.10 and A4J 9.0.3. I used web request instead of Slack for notification.
The hardest scenario is sending notification when an issue is moved between an Open and Future sprint. IMHO, the following is a difficult:
from: closed-sprint, active-sprint
to: closed-sprint, future-sprint
Finding the delta between the 'from' and 'to' list using smart values requires using some Set theory and basic math.
The solutions that use the smart value "{{opensprints()}}" do not work for all scenarios. As of version 9.0.3, A4J does not how to call a JQL function inside a smart value tag. So, what you get from {{opensprints()}} is actually a null (or EMPTY) value, because opensprints is undefined.
I put the solution in github: send-notification-add-remove-issue-sprint
An issue's "sprint" field contains all previously participated closed sprints, plus possibly an open or future sprint.
When an issue's sprint is changed, the {{fieldChange.to}} and {{fieldChange.from}} records contains a string of comma delimited sprint IDs.
During any sprint change in the A4J rule trigger there could be at most one sprint change, either one is added, removed, or changed (from open to future, or future to open).
My solution uses Jira and A4J features. It does not use JQL or ScriptRunner functions, which someone may have solved it using them.
My solution treats {{fieldChange.to}} and {{fieldChange.from}} sprint IDs as two Sets. By using basic math and set theory (union and intersection), we can find the 'changed' sprint, then we call the REST API "agile/1.0/sprint/{{sprintID}}" using a web request action to get the 'changed' sprint's state to determine whether it's Open or Future.
summarized steps in the rule
fromList = list of previous sprints
toList = list of current sprints
mergedList = fromList union toList
removedSprintId = mergedList - toList
addedSprintId = mergedList - fromList
if a sprint was added then
a. get the 'added sprint' record via REST API
b. if the sprint is active (open) then send 'add' notification
if a sprint was removed then
a. get the 'removed sprint' record via REST API
b. if the sprint is active (open) then send 'removed' notification
The solution uses a web request for notification (instead of slack). You can easily replace it with another action such as email or slack.
1) We need to update the following to make the rule work for you:
2) There are more details embedded in the rule's description.
3) For what is worth, the rule has simple examples on usage of the following that can be helpful on writing future rules:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm the following...
This works for "added to current sprint":
And this works for "removed from open sprint":
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.
@Nate Dame this works for me, but it also alerts me if I remove tickets from Future Sprints.
I want to be notified only if I remove ticket from current Active Sprint and not from Future Sprints, could you please help me with that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had the same problem @Varun Modi !
Honestly I gave up even though its not ideal.
If anyone has a solution I'm all ears!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nate Dame and @Varun Modi
I put my solution in GitHub: send-notification-add-remove-issue-sprint. It will cover all add/remove issue from current or future sprints. It sends notification via web request, which can be converted to Slack or email.
I also want to clarify that the Smart Value {{OpenSprints()}} will always return EMPTY (NULL), because we can't directly call the JQL function in a Smart Value expression.
So, the expression
{{fieldChange.from}} equals {{OpenSprints()}}
is the same as
{{fieldChange.from}} equals NULL
Therefore, we will get notification when an issue is removed from active or future sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I believe you could probably try something like this for removal from a current sprint -
For adding to a current sprint you could try this -
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Rory Standley this works for me, but it also alerts me if I remove tickets from Future Sprints.
I want to be notified only if I remove ticket from current Active Sprint and not from Future Sprints, could you please help me with that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Florian Pfaff ,
this is a tricky one I believe. I do not have an out of the box solution and the only way I see is to create a webhook that is fired by an Jira sprint updated event (you can create webhook urls in Slack). The webhook url could include the SprintID that has been updated. But even if you could use the SprinID to get all issues within the Sprint it would not help you as you will only get issues from the current sprint not the issues that have been removed. By searching across the internet I found some possible enablers like the Scriptrunner removedafttersprintstart function (and there might be similar on that you could use).
Another idea might be to create a custom field (e.g. "original sprint"9 that keeps the Sprint of last assigned Sprint and then you could compare it towards the current Sprint.
Really everything is not straight forward and I would really be interested how others are solving this.
BR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't think there is such an option...
These are the options for Sprints:
You can choose the "when issue edit" and check if the sprint value changed, but it will not check about active sprint or not active sprint
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.