Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get sprint goal for open sprint

Salim Bouassida October 18, 2022

Hello there,

 

I am trying to create a Jira automation that send a slack message that contains the sprint goals for two teams.

 

Initially i had this structure:

When

  • scheduled (every 2 weeks)
  • JQL: project = Understand and Sprint in openSprints()

 

Create variable
  • Smart issue: sprintgoal = {{#issue.customfield_10015}} {{#if(equals (state, "active")) }} {{goal}} {{/}} {{/}}
  • (our sprint goal field is linked to customfield_10015)

Slack message

  • send {{sprintgoal}} 

 

However, I noticed that it would send 20 + message for each issue that matches that JQL. I then tried to set an if statement checking a smart value "done" has a value, but it still sends the message 20 times.

Capture d’écran 2022-10-18 à 09.59.17.png

 

Do you have an idea to pull the Sprint goal for only the first issue in the JQL list?

 

thanks !

3 answers

1 accepted

2 votes
Answer accepted
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 19, 2022

OK @Salim Bouassida @Bill Sheboy 

I have it working...at least to email, but theory is the same for Slack.

Schedule trigger (no JQL)

Lookup issues action with 


sprint in openSprints()

as the JQL.

 Send email/Slack action with:



{{lookupIssues.first.sprint.distinct.goal}} 
Salim Bouassida October 20, 2022

Hello @Curt Holley ,

This worked perfectly !

I didn't need to create the variable, and used the reference in the slack message only.

 

Thanks for your help ! 

Like # people like this
2 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 18, 2022

Hi @Salim Bouassida 

As Curt noted, your rule has JQL in the scheduled trigger.  And for Jira Cloud, this mean it will try to execute for each issue. 

Two possible solutions are:

  1. better solution: trigger your rule on "sprint started" instead of a schedule, and send the information using {{sprint.goal}} as each of the sprints start.  This will create one Slack message for each sprint start.
  2. brittle solution: remove the JQL from the trigger, and instead use it with a Lookup Issues action.  Then grab the information for the open sprints with {{lookupIssues.sprint.distinct.goal}} which will list all sprint goals found.

Solution 2 is brittle because you may have carried over work from prior sprints, and when you do the wrong goals could be listed.

Kind regards,
Bill

Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 18, 2022

Option one is the go for sure!!! A much better solution indeed @Bill Sheboy 

Like Salim Bouassida likes this
Salim Bouassida October 19, 2022

Hello @Bill Sheboy @Curt Holley ,

 

Thank you for your insights, it does help a lot with the reflection.


The automated slack message is a reminder a few days before the sprint review, so the option 1 does not work in my situation 🙁

 

I could remove the lookup from the trigger and have a Lookup Issues action, but that still creates a message for each issue in search.

 

1- Variable

{{#issue.customfield_10015}} {{#if(equals (state, "active")) }} {{goal}} {{/}} {{/}}

Gives me the right sprint goal, but 20 + times

 

2- Variable

{{lookupIssues.sprint.distinct.goal}} 

Gives me current and past sprint goals, but 20 + times

 

I wonder if I can change the variable (1) to only include the sprint goal once (not for each issue)?

Capture d’écran 2022-10-19 à 09.07.35.png

I saw @Curt Holley recommendation to use a label on one ticket in the sprint, and use that as a lookup, but I want to make the automation so simple, that the team doesn't need to do anything if I'm not there (ideally)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2022

For method 1, the work-around is to gather the goals (with repeats) using a delimiter, and then split them again to grab just the first one.

For method 2, if you believe the lookup will contain just the issues you want, you can grab just one issue using first (or last), and then access the field:

{{lookupIssues.first}}

Like # people like this
1 vote
Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 18, 2022

Hi @Salim Bouassida 

It is going to be to do with the fact that you have the JQL in the Scheduled trigger. 
As that means the rule will action for every issue returned from that trigger.
So, at a high level, you need to have a JQL that will only find one issue.


Best idea I can think of (off the top of my head) is add a label to an issue in the sprint and add that into the JQL so it only finds that one issue....not ideal, but....food for thought perhaps?

Good luck!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events