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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Get active sprint name in smart value for automation

I have a few issues that get moved from sprint to sprint. Because of that, the "sprint" list ends up being an array of names. My ultimate goal is to figure out which active sprint a certain issue ends up moving to a certain status ... like "dev complete" or something. I create a rule to output a custom variable where I clean the sprint name:

{{sprint.name.substringBefore(" -")}}

The problem is, I'm getting an array of sprint names when I move something to "dev complete" and I only want the sprint name for the ACTIVE sprint, not all the sprints this one issue is a part of or has been a part of.

Any help?

1 answer

1 accepted

0 votes
Answer accepted

Hi @Jason Anthony Montilla  -- Welcome to the Atlassian Community!

Yes, that sounds correct when an issue has been in multiple sprints which have closed over time.

One way to always have the current, open sprint is to add a custom field to issues, such as Current Sprint.  And then create an automation rule to set it when the sprint starts for the issues currently in scope. This gets trickier if you often add issues to a sprint after it begins, and would require an additional rule to manipulate the sprint values.

Best regards,

Bill

Hi Bill, thanks for the answer! So I did discover something that may also be a possibility. I'm new to the conditional logic for smart values.... but I'm having a time trying to figure out how to loop through with a conditional statement. Here's what I came up with that doesn't work:

{{#sprint}}{{#if(not(isClosed))}}{{name}}{{/}}{{/}}

We start iterating the "sprint" list but we seem to lose the tie to it as soon as we break into the if. Any pointers there?

Hi!  Well, the A4J is awesome...and...it does have some limitations.  ;^)

I believe that even if that syntax could work, it wouldn't for another reason: functions cannot work inside of an iterator structure (stuff with # / bracketing).  I submitted a separate defect/suggestion on that one.

What is the format of your sprint name?  Knowing that may help uncover how to parse this out.  For example, if your sprint names contain the date values, you can definitely use the max/min syntax to get info and maybe re-create the name:

{{issue.sprint.startDate.max}}

If that won't help, I suggest the work-around idea using the custom field and supporting rule.

Sure, I can look at that workaround. I just want to see if there is another way to skin this.

 

The sprint names are basically:

Sprint 123 - Some random text

No dates, but using {{issue.sprint.startDate.max}} on an issue in multiple sprints... how would I pull just the name of the 1 with the max startDate?

Hi again,

Okay, this works using a created variable and text parsing to return the "active" sprint.  Sprints have a state attribute which we can use.  I found the name of the attribute using this technique:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

  • Use the action Create Variable, such as sprintStates with this value.  This forms a delimited list of sprint states and names.
~{{#sprint}}{{state}}:{{name}}~{{/}}
  • Grab the active sprint with this to parse with RegEx and remove the remainders.
{{sprintStates.match(".*(~active:.*~).*").remove("~active:").remove("~")}}

Note that if your sprint names use the ~ character or phrase "active:" you will need to tweak this a bit.

Also, this works for one issue at a time, so if you have a JQL set, you will need a branch to process each issue singly.

Best regards,

Bill

@Bill Sheboy That is pretty advanced and awesome stuff! I'll take a look and let you know. Thank you so much!

Like Bill Sheboy likes this

You are welcome.  I'm glad there's an answer, as this question has appeared several times.  I used a similar technique to selectively add/remove items from components and labels.

Have a great weekend!

Like Jason Anthony Montilla likes this

@Bill Sheboy Actually haha ... it didn't really do quite what I wanted but I think it may be the regex... here's the result:

RAV 58 - GR 2020closed:RAV 57 - Bugsclosed:RAV 55

You can see that Rav 58 (which is active) indeed shows up, but now I get the other 2 sprints this was a part of as well. I'm NOT a regex master.

 

Maybe I remove everything with .closed

Please try logging the created variable to see what the result looks like.  That will help us figure out what RegEx to use.  Then post both values (full variable and after parsing).

If you use the two examples I provided, it should work unless my RegEx is wrong too.  ;^)

BOOM ... it was really close:

{{sprintStates.match("~active:(.*?)~")}}

Thanks again Bill!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
Community showcase
Posted in Jira Software

Presenting the "Best of 2020" Jira Software roundup!

Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...

7,071 views 8 28
Join discussion

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