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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,630
Community Members
 
Community Events
176
Community Groups

Need help with JQL when only 1 Component has been entered when needs 2 Componets

Here is a scenario. I am using colors and objects to explain. 

My Stories require that a user adds two Components: Blue, Shirt. 

However, my users sometimes forget to put color or object.  I have an automation rule setup on the backend to catch what new ticket has been created with both components. However, if it's missing one of them, the rule does not run. 

I need help creating a JQL query that can tell me which Story has only 1 component. 

In my organization, I cannot have a new field with the values (these values change). I must use the component/s field. 

I am not a programmer or know the code. I just need a JQL code to be able to catch a ticket with only 1 component listed on Stories only. 

Thank you!

Diana

2 answers

1 accepted

0 votes
Answer accepted

There is no way to do this directly, JQL is for finding issues, not processing the data on them.  You could search for issues with Blue, or Shirt, or both at the same time, but you can't search for issues which have an arbitrary set depending on other bits of the set.

However, you could get a little bit clever with some reporting. 

I would set up a new dashboard, and add three gadgets to it.  You could easily use it to find issues that are not right.

  • Gadget 1: 
    • Filter for "components = Blue and components != Shirt"
    • I'd probably use a simple "filter statistics" for this, grouping by whatever is most useful to you (assignee maybe?  Or project).  Or maybe just the flat list of results so you can jump straight to a bulk edit.
  • Gadget 2: 
    • Filter for "components != Blue and components = Shirt"
    • Same settings as gadget 1
  • Gadget 3:
    • Filter for "components in (Blue, Shirt)"
    • Two dimensional filter statistics, but (unusually) both axes set to "Components"
    • This will give you a grid where you can quickly see where Blue and Shirt are not intersecting (and where they are!)

Gadgets 1 and 2 immediately show you where you have "broken" issues.  If you actually have multiple combinations, you might want to adjust them to be more like "components in (Red, Black, Blue) and components not in (Shirt, Jeans)

Gadget 3 might not be that useful, but it might be quicker, especially if you have more than just Blue and Shirt to work with.

Hello Nic. Thank you. I tried your Gadget 2 idea and I was able to get the report to pull what I needed. 

Hi @Diana Leon -- Welcome to the Atlassian Community!

You could check the number of components with the following in your rule:

 {{issue.components.size|0}}

You could use that in your issue created rule, or in another rule checking for changes to components.

With JQL, I believe with out-of-the box features you may only check for EMPTY or IS NOT EMPTY for components.

Kind regards,
Bill

Thank you, Bill. I tried it but it returned an error. The solution above gave me what I needed. Many thanks again! 

Like Bill Sheboy likes this

I am glad you solved it, Diana.

Out of curiosity, did you see an error trying that in your automation rule, or in some other way?  And, what error did you see?  When I tried that in a rule similar to what you note it worked without error.

Hi Bill. Thank you for getting back to me. I was using it in the Issues/Search Issues but not on automation. I have created new automation. Is this where it is supposed to go? 

Save picture 6.JPG

I tried it and it did not work. 

No subsequent actions were performed since JQL condition did not pass due to error running JQL:
"(key IN (TICKET NUMBER) AND (2))" - Error in the JQL Query: Expecting operator but got ')'. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 33)

Thanks for your rule image and additional information.  I should have been more clear that I was suggesting to use a condition in the rule.  For example:

  • trigger: issue created
  • action: Re-fetch (to prevent the known timing problem which could occur)
  • advanced compare condition: 
    • first value: {{issue.components.size|0}}
    • condition: does not equal
    • second value: 2
  • action: comment/email/... to notify that the components do not match what was expected

Nic's answer with the dashboard gives you the overall status view of issues meeting/not meeting your component criteria.  I was also suggesting the rule approach as you already noted using an automation rule.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events