Ask how to use Lookup issues action

koutarou ishibashi February 29, 2024

I would like to search for subordinate tickets using the Lookup issues action and calculate the number of issues with a status of DONE and the number of issues with a status other than done.

Is there a way to use {{lookupIssues}} to display the number with a status of done and the number with a status other than done?

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
March 1, 2024

Hi @koutarou ishibashi 

You may use multiple Lookup Issues action calls, with different JQL; or use one call, and list iterators, smart value, list filtering and math expressions to do that: 

For some examples...

To get the count of the Done issues, that would be this:

{{#=}}0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+1{{/}}{{/}}{{/}}

That works by iterating over the lookup, filtering by status category, adding 1 for each issue found, adding a default value of 0, and summing the results.

To find the not-done ones, wrap the equals() condition with not().

Kind regards,
Bill

koutarou ishibashi March 2, 2024

Thank you for your reply. It was very helpful.

By the way, I would like you to let me know, but I am having trouble searching for dropdown fields that have dropdowns A, B, and C using the method below.
How can I search for a dropdown field?

{{#=}}0{{#lookupIssues}}{{#if(equals(customfield_10209,"A"))}}+1{{/}}{{/}}{{/}}

Bill Sheboy
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.
March 2, 2024

For a selection field, there is a value attribute, such as this:

{{issue.mySelectionField.value}}

 

To confirm you have the correct expression for the counting, please answer:

Is your custom field single selection or multiple selection?

Are you trying to find issues where one of A, B, or C are selected, or all values A, B, and C are selected?

 

koutarou ishibashi March 2, 2024

The field is a single selection. This is a question in which one of ABC is selected.

Bill Sheboy
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.
March 3, 2024

As noted, the value attribute may be used for comparison.

What are you trying to do, once each value is detected:

  • count issues with a value
  • something else?

To count issues with a value, this would count the ones set to value "A"

{{#=}}0{{#lookupIssues}}{{#if(equals(customfield_10209.value,"A"))}}+1{{/}}{{/}}{{/}}

 

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 29, 2024

Hi Koutarou,

Yes, you should be able to do that. 

Create your rule and add your lookupIssues action. Add your JQL that identifies the Done ones. 

Then you can create a variable if you want to go that route which would be the variable name and this code: {{lookupIssues.size|0}}

Then you use the variable name for updating a field, or include in an email, etc. 

koutarou ishibashi February 29, 2024

I would like to search once as below.
"Parent Link" = {{issue.key}}

Is it possible to identify them using {{lookupIssues}}?

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 29, 2024

Yes, it would look something like this:

Screenshot.png

koutarou ishibashi February 29, 2024

Is it possible to search using only the search below?
"Parent Link" = {{issue.key}}

I would like to search only once and use {{lookupIssues}}.
I would like to know how to use the following correctly.

{{#if(lookupIssues.status.name.eq(dode))}}
{{lookupIssues.size|0}}
{{/}}

{{#if(not(lookupIssues.status.name.eq(done)))}}
{{lookupIssues.size|0}}
{{/}}

koutarou ishibashi March 1, 2024

Searches take a long time and lock automation rules.
So I only want to search once.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2024

If you are getting Done and Not Done counts, it will have to search twice. 

Like koutarou ishibashi likes this

Suggest an answer

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

Atlassian Community Events