Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Issue with labels in Automation

I am trying to create an automation rule where each time an issue is moved to a new sprint, a new label is added with the name of that sprint.

 

More specifically, if the issue was added to a sprint that is already in progress, it should receive that label. I'm receiving the following error with the below rule. Can anyone help?

 

 Capture2.PNGCapture1.PNG

1 answer

1 accepted

0 votes
Answer accepted

Hi @Ankit Aggarwal 

That error tells you Labels cannot contain spaces, which is correct.

Without seeing the details of your edit, I am guessing that you are trying to add to Labels with {{issue.sprint}} or {{issue.sprint.name}}

The sprint field is a list, and when you use it that way it is split into individual values delimited by commas and spaces.  So you could remove the delimiters or substitute other values.

However I wonder: do you only want to add one Label for the current open sprint?  In that case you may use this expression to process the sprint list with conditional filtering to just get the active sprint's name for the label:

{{#issue.sprint}}{{#if(equals(state, "active"))}}{{name}}{{/}}{{/}}

Kind regards,
Bill

Thanks for the reply @Bill Sheboy . I was using {{sprint.name}}.

Capture.PNG

 

But yes, I only want to add the current open sprint to the list of labels. Where would I put the below expression?

{{#issue.sprint}}{{#if(equals(state, "active"))}}{{name}}{{/}}{{/}}

 

The answer depends on whether or not you expect your sprint names will contain spaces:

  • If no spaces: you may paste that expression into the Values to add for the Labels edit.  It will appear below the field, so select it to set it.
  • If yes to spaces...You will need to remove the spaces first using a temporary variable
    • First, before your edit add an action to Create Variable
      • Name: myNewLabel
      • Smart value: {{#issue.sprint}}{{#if(equals(state, "active"))}}{{name}}{{/}}{{/}}
    • Next, use that variable in the label edit, by removing spaces
      • {{myNewLabel.remove(" ")}}

Genius! Thanks @Bill Sheboy , it worked!

I am glad to learn that worked!  Please consider marking this question as answered to help others in the future searching for similar use cases.  Thanks!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS

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