Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I automate adding the component value as a label?

Samrudhi Shete October 4, 2024

Screenshot 2024-10-04 at 3.08.59 PM.png

I want to set up an automation for the component field dropdown. The goal is to automatically add a label to an issue with the same value as the selected component when the issue is created or when the component field is edited.

3 answers

1 vote
Dave Mathijs
Community Champion
October 4, 2024

Hi @Samrudhi Shete Which problem are you trying to solve and why? I don't see the added value of duplicating values from one field to another in the same issue.

Samrudhi Shete October 4, 2024

Hello @Dave Mathijs we need this labels for tagging some Id's and for the Dashboards .. My question lies around how to access this field I tried with {{issue.components}} / {{triggerIssue.components}} which is not working 

Samrudhi Shete October 4, 2024

@Dave Mathijs  Can we create a smart variable.. I am mainly trying to add some ID's over issues with automation which are dependent on the value of this component field can I get this component value as smart variable to further compare an assign id

Dave Mathijs
Community Champion
October 4, 2024

Following smart values (variables) are available for Components:

  1. Access the first component of an issue: {{issue.components.first.name}}
  2. Access all components (returns a list of component names: {{issue.components.name}}
  3. Check the number of components on an issue: {{issue.components.size}}
  4. Access a specific component by index (for example, the second component): {{issue.components.get(1).name}}
  5. Access the description of a component: {{issue.components.first.description}}
John Funk
Community Champion
October 4, 2024

I think he is looking for a way to get the most recently added one to the issue. 

Like Dave Mathijs likes this
Stephen_Lugton
Community Champion
October 4, 2024

In that case:;

{{issue.components.get(issue.components.size.minus(1)).name}}

0 votes
Stephen_Lugton
Community Champion
October 4, 2024

@Samrudhi Shete you could use {{issue.component.name}} but if you had multiple components on an issue that would not work as it would create a comma separated list with spaces that won't work with labels.

Or {{issue.components.get(issue.components.size.minus(1)).name}} would give you the last component added

 

But I agree with @Dave Mathijs

0 votes
Prachi Bolar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2024

Hi @Samrudhi Shete ,

Welcome to community :) 

could you please confirm if you looking for something below

Screenshot 2024-10-04 at 3.18.15 PM.png

Screenshot 2024-10-04 at 3.19.52 PM.png

 

Thank you,

Prachi

Samrudhi Shete October 4, 2024

I want the same value as of component field as label 

Prachi Bolar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 4, 2024

You can try something like this.

 

  • Trigger: Issue Created or Issue Updated
  • Condition Check if "Component" is not empty
  • Action: Edit issue to set "Labels" to {{issue.components.name}}

 

Screenshot 2024-10-04 at 3.49.34 PM.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events