Forums

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

Jira Automation get count of issues with current issue label.

İsmail Özçelik March 2, 2022

Hello,

I need a condition to execute rule.

So I need a query like this:

createdDate>'-1d' AND summary ~ KEYWORD AND label = {{triggerIssueLabel}} 

count less than 5. Then execute else do nothing.

 

However I cannot write a query like this.

1 answer

1 accepted

1 vote
Answer accepted
Mark Segall
Community Champion
March 2, 2022

Hi @İsmail Özçelik - I'm not sure of the trigger, but I was able to accomplish this with a couple actions:

  1. Issue Lookup: I used this to execute the query and get the issues matching the query
  2. Create Variable: {{issueLookup.size}} gave me the number of issues that matched the query (I called it issueCount)

From there you could use an If/Else condition with the newly created variable {{issueCount}}

Hope this helps.

İsmail Özçelik March 2, 2022

Hi @Mark Segall ,

Thanks for answer. But still I cannot get the label from issue and use it inside query.

Mark Segall
Community Champion
March 2, 2022

Can I get a screenshot of your rule?  It would help to have more context around the trigger and actions.

İsmail Özçelik March 2, 2022

SmartSelect_20220302-195536_Chrome.jpg

@Mark Segall ,

This is my test rule. I try to add label condition.

Mark Segall
Community Champion
March 2, 2022

Thank you this clears things up for me. So, you'll want something like this in your JQL:

createdDate>'-1d' AND summary ~ ACIL AND labels = {{triggerIssue.labels}}
İsmail Özçelik March 2, 2022

Thanks, some smart values gave error before so I don't think it. 

Mark Segall
Community Champion
March 2, 2022

sorry - My query had an error.  I fixed it.  Should be {{triggerIssue.labels}}

Mark Segall
Community Champion
March 2, 2022

Also - Note that if there's any possibility your issues will have multiple labels, you probably want to go with "IN" instead:

labels IN ({{triggerIssue.labels}})

İsmail Özçelik March 2, 2022

Ok, I try 4 times, get all error :) I will continue.

Martin Cleaver
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.
August 8, 2022

Following up in a new question at  Nulling a clause when count is zero (atlassian.com)

A related problem I have is:

((labels in ({{triggerissue.labels}}) OR otherclause)

If there are any labels I want them to expand, e.g. 

labels in (label-1) or otherclause

But if labels are empty I don't want:

labels in () or otherclause

I just want:

otherclause

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events