Lookupissues JQL seems to ignore "If" filter

Erin Liva
Contributor
November 22, 2022

Hi -

To save reading time I am stating up front that we are using Cloud Team Managed projects and do not have scriptrunner (nor is it likely to be installed in the future).

Background: We have created an issuetype 'Requirements' and have subtasks that, once completed,  would satisfy the Requirement. Weekly we have to report our progress to the Stakeholders at the Story/Requirement level. Currently we grab the latest subtask due date and total up all the subtask story points into the fields at the Requirement level. 

What we are struggling with is the ability to find all the 'done' tasks under the requirement, total the story points up and place that number in a custom field on the Requirement/story level called 'Completed Story Points'.  From there we can report the percentage done to align with the graphic at the story/requirement level by doing some calculations.

Challenge:

To be safe until fully tested, this is a manually triggered automation at the subtask level. This triggered subtask was done and had 2 story points. Another subtask had 1 story point and was also done. The remaining subtasks (2) were still in other states of progress so should have been filtered out. I therefore expected a result of 3

1. The If filter is already narrowing the issues to subtasks that have a Requirements issuetype as a parent in order to filter out other parents that are stories, tasks, epics etc.)

2. My assumption was that I needed the lookupissues task in order to create a list where I can total up the story points of only the stories that are done so I replicated the JQL which I thought should be the resultset from the If: all match.

3. Once I get that list the total would be stored in a variable for use in the Parent.

The result totaled all story points across the project that were done (147). The log entry of 6 was all story points whether done or not in the triggering subtask.

I have tried many iterations of automation without success and am asking for assistance. 

 Automation.pngCreate Variable.png

Edit Issue.png

Audit Result.png

[@William Sheboy Thank you for directing me to the questions board as I am very new to automation so have limited understanding at this point]

 

2 answers

1 accepted

0 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

Hi - I think the issue is that variables in Automation are scoped locally, so your {{TotalStoryPointsDone}} doesn't even exist within the Parent branch.

What I would try is to Edit the issue field for the Parent and put in directly:  {{lookupIssues.Story point estimate.sum}}

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

This is not quite right. I'm still working on it.

I think the variable thing may be right, BUT ALSO, your JQL query does not scope the results to only subtasks of the PARENT of the current subtask.

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 22, 2022

WELP, I spent a lot of time on this, and I feel like this should have worked, but it weirdly never makes it to the Parent block (my "DID IT GET HERE?" message never gets logged), so literally have no idea why this isn't working but I suspect it is some Team-managed Project weirdness.

Any thoughts, @Bill Sheboy ?

Screen Shot 2022-11-22 at 3.53.52 PM.png

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.
November 22, 2022

Hi @Erin Liva and @Darryl Lee 

Erin, sorry I didn't see your mention sooner...It appears you noted my old account that I no longer can access.  Darryl mentioned my new one...so here I am  :^)

First thing, I wonder if the problem is the assumption the IF condition impacts the Lookup Issues: it does not. 

  • The only thing impacting the results of the lookup is the JQL you use.  Your lookup JQL doesn't even specify the project...which definitely could be more issues than you intended to gather.
  • I suggest testing your JQL in an advanced issue search first to get it working, and then use it in the rule with lookup issues.

Next, please consider posting an image of your complete rule and the audit log details from the execution.  The full context may help us see what is happening.  Thanks!

 

Hey, Darryl!  My understanding of created variables is that once they are defined, they are "global" from that point forward in the rule...with one exception: branches...

  • Branches which could have more than one issue run asynchronously and in parallel.  For those, the variable essentially goes out of scope and gets zapped over and over, leading to no predicable outcome.  I would expect the value set to a variable before the branch to remain unchanged after the branch exits...but as there is no guarantee that such branches finish until the end of the rule...who knows.
  • Branches which have one-and-only-one issue (e.g. parent, last created issue, etc.) can see the same created variables from earlier.  My understanding is one-issue branches are "unrolled" and run inline.

Kind regards,
Bill

harry
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 22, 2022

informative post it is really helpful for me.

Like # people like this
Erin Liva
Contributor
November 23, 2022

Hi @Darryl Lee

I can't use {{lookupIssues.Story point estimate.sum}} in the Parent because it will automatically sum up all the story points for all the subtasks whether they are done or not. 

Based on earlier answers, The IF: statement is not like a programmers version where it reduces and then passes the filtered dataset result so thinking I don't need this and should only use Lookupissues since it ignores what was previously filtered?

Is there a way in lookupissues to say: 

Project = "People MDM" AND issuetype = 'subtask' AND status in ("Done", "Cancelled") AND [Parent matches issuetype = "Requirements"]?

Then I could possibly get the list of the completed subtasks under that Requirement (Story) and count the story points?

Erin Liva
Contributor
November 23, 2022

@Bill Sheboy Thank you for helping on this! I did include images of the audit results and components in my original post. I am embarrassed to say my previous attempts were much more complex/longer (started at the parent level) but then thought I was overthinking it and trimmed it down to the above. 

The rule is restricted to only the one project so I thought reiterating the project name was redundant.... but you are right, caution should prevail. :)

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.
November 23, 2022

Erin, reading your question about the Lookup Issues JQL, to get sibling issues of the same parent, try checking the parent.  Let's assume the trigger issue is a subtask, and so try adding:

parent = {{triggerIssue.parent}}

Like Erin Liva likes this
Erin Liva
Contributor
November 23, 2022

Yippee! Thank you. That worked :)

Audit Result 2.pngAudit Result 3.png

Like # people like this
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.
November 23, 2022

Awesome!  I am glad to hear that worked for you.

Like Darryl Lee likes this
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2022

Hi @Erin Liva so glad you got it working. Would you mind sharing your final rule? For some reason I had problems with the Parent related branch, and only was able to get it to work with a JQL related branch that seems to do the same thing.

Perhaps it's because I'm using a Manual trigger instead of actually off of a field change. In production you said you're triggering off of your subtask being completed, and in my example I'd be triggering off of tasks being completed.

Anyways I think {{lookupIssues.Story point estimate.sum}} will work because the Lookup filters for only tasks that are Done (this is a change from my earlier test rule).

And {{triggerIssue}} might be better to be very explicit about which issue we're talking about.

Here's what seemed to work for me:

Screen Shot 2022-11-23 at 2.06.00 PM.png

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 23, 2022

One last point, which is kind of a bummer, is that in Company-managed projects you could make your Total Story Points field read-only. I looked to find this in my Team-managed project, and alas, apparently it's an open request.

https://jira.atlassian.com/browse/JSWCLOUD-21916

Erin Liva
Contributor
November 28, 2022

@Darryl Lee it would be great if they gave you an option to make fields (especially custom fields) read-only. Alas I am still waiting for a higher need of being to add other issue types under a story e.g. Test issue type vs. subtask.

As for the final code, do you want the extract of the rule or screen prints (and where you want me to send them). 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 28, 2022

Hey, @erin - I was just interested in a screenshot of the final rule you came up with, including the logic of what kind of branch you used, with the JQL and/or Lookup, etc. Might be useful or others too.

Hrm, interesting about your need to put Test Issues (or other types) under a Story. I found an add-on that offers this:

https://www.adaptavist.com/blog/improve-project-structure-by-adding-new-jira-hierarchy-levels

Erin Liva
Contributor
November 28, 2022

@Darryl Lee our company Admins are newbies with Jira. I was surprised that I was the first to use dashboards and automation here. I will ask but not holding my breath.

Erin Liva
Contributor
February 27, 2023

@Darryl Lee I couldn't find a place to send you a message on the rule. I finally decided to go ahead and post on the closed issue. Can you please let me know if there is a better way to send you things vs. reattaching here?Sum all subtasks done in Requirement story.png

0 votes
Erin Liva
Contributor
November 23, 2022

The suggestions given successfully solved my issue. Thank you to @Bill Sheboy @Darryl Lee  for helping me with this.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events