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.
[@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]
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}}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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...
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! I am glad to hear that worked for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The suggestions given successfully solved my issue. Thank you to @Bill Sheboy @Darryl Lee for helping me with this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.