As you are apparently using Jira Cloud, you could use the built-in automation for Jira rules to update the task to be the average of the sub-tasks' values.
The difficulty of this depends upon the field you need averaged. There are some fields supported by the Lookup Issues action that make that easy. Otherwise you would need to gather the issues using the REST API and JQL from the rule to do this.
Kind regards,
Bill
Thanks @Bill Sheboy ,
In my case is the same field for the tasks and subtasks, this field type is difficulty of to find in JQL search?
By the way, do you know the fuction for calcule average? i searched in Jira suport but i don't find...
Kind regards,
Douglas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Douglas, as that is a custom field it will not be listed in Lookup Issues, but with subtasks you can do this with average. With an automation rule that would be something like this:
{{issue.subtasks.Progresso.average|0}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy
i belive that this rule would will work, but i have some diferents subtasks, in this case i havent how to use this condition. I tried use a branch but doesnt work, you know some way to do this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That smart value I provided will average for any subtask types. If you having trouble using the smart value, then:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again, @Bill Sheboy
I tested the smart value and its worked good, but the trigger is the problem, i used in this way how on the picture.
but doesn work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the problem with the trigger: is it not picking up changes for your custom field?
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.
I get finded the trigger error, Nothing happens because the field "Progress(%)" is changed by a other rule when i chang other field. I needed of add other fields for my Trigger
Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy
I used your solution with linked issues using Smart Values
{{issue.issuelinks.outwardIssue.Progress.average|0}}
and it worked as well!
It means that one can use also linked issues.
My automation looks something like this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Bill Sheboy . I hope you will be so kind and extend a bit your solution.
Question 1:
Could you please help me with a small extension of the solution we discussed above?
I know now how to calculate the average of ALL outward issues, no matter what linke type they use. Is there a way to select only ONE issue link type and calculate the average? I have now two link types in my config and the average is then false.
Question 2:
Do you know where I can learn more about what methods are possible to be selected in Smart Values.
Like in our example:
issue -> issuelinks ->outwardIssue - where can I check that?
The documentation does contain some examples but where is the whole library with what is possible to be used?
I am looking foward to your reply.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For your question 1, you could try a couple of things:
Regarding question 2, I think you are asking a couple of questions here, and I wish there was better documentation in this area:
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.
Thank you very much @Bill Sheboy for the prompt reply.
I found out (too late) that the lookup issues action is available only in the Cloud and I wasted some time for looking for it. I checked also that there are no plans to roll it out (the lookup action) to DC/Server any time soon. Unfortunately the discrepancy between functionality of Automation in Jira Cloud and DC is not a good thing which, in my case, will necessitate the fall back to ScriptRunner in more advanced scenarios.
I hoped for some time that Automation Cloud will be just two steps ahead of Automation Server/DC and the latter will catch up, only later. Unfortunately it is not happening and these two will probably differ more and more, ie. Automation Server/DC will not be further developed. One can experience it very easily when comparing the SmartValues documentation which you referenced for Cloud and the DC version here: https://confluence.atlassian.com/automation/smart-values-993924860.html
Thank you again for your post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My apologies as I did note you were using the Server/Data Center version.
Instead of Lookup Issues, the Server/Data Center version has a "bulk handling" option that can be used for a branch (or scheduled trigger with JQL). Just select that option and then use the {{issues}} smart value. Note that name is plural, indicating it is treating the results as a smart value list. The same functions should work with that list.
https://confluence.atlassian.com/automation/bulk-handling-of-issues-993924653.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again @Bill Sheboy
First of all, no need to apologize :) I wasted the time first and then asked you for help. However, it was not all wasted, because I finally found the answer to where to find SmartValue names for specific fields. There is an article explaining this here:
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.
Well done! I often reference that how-to article to confirm smart value names, spacing, capitalization.
Now if you want to use that average you have created to do something like edit the trigger issue, the options to use that value are a bit limited:
Once inside of the branch you can no longer use Edit Issue to change the trigger issue, as it is not the "current" one; the branch issues are.
A work-around would be to call the REST API at that point for an edit on the trigger issue. Another would be to add a "magic comment" to one issue from the branch, thus triggering a second rule which could update the original issue via a branch. Both seem a bit convoluted to solve an edit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are right. Once inside of the branch all you can do is to write the average in every linked issue - you cannot go out of the loop.
But, I will give it a go with the REST API. I found out during my intensive exercises that there is an easy way to use SmartValues and get a unique link address of an issue, which is then displayed in JSON format.
Use the Action: "Log Action" and paste this. This will give you this uniqe link.
{{issue.self}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your first paragraph is interesting to me: I thought when the "bulk handling" option is selected for Server/Data Center version the branch executes once and not for each issue. If for each issue, calling the REST API n-times may not be what you want!
I recommend confirming this with an experiment inside that branch with 3 test runs:
Sorry, I do not have that Jira version so I cannot test this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I did some the testing you mentioned earlier and, to be honest, I was disppointed with the fact that log action is written only once but when you put the same value in the Edit action, then it is written in every issue in the loop. I am happy to share the results of my experiments.
Below is the Automation Log result items from the enclosed picture
1. this is the average formula, correctly calculated, taking into account only the issues linked with the link type: "is Objective of" - this is what we discussed earlier that it would be great to get that output outside the loop and put it into the triggering issue.
2. this is the test showing that the log will write only one value, if you use SmartValue "issue" and not "issues". This will take the last issue in the loop into account. If you use issues, the result will be 3
3. this is the test showing that the log writes only the data from the last issue in the cycle, if you use SmartValue "issue" and not "issues".
4. as soon as I put the same formula from point (3) and edit the Description value, so it is action: Edit, field: Description, value: {{issue.key}}, then the automation does that operation three times, because I have three linked issues.
So, I suspect, if I did it with action "Send web request" to use REST API, these calls would happen 3 times as well, unless there is some trick (with the condition?), which will stop the loop after the first linked issue update.
If it happened only once, then it would make sense to use it as trigger for another Automation. Then I could find the "parent" of the triggering issue and copy the value. Not so an elegant solution but it would be good to have it available.
Anyway, this is a very time engaging exercise but expands the horizons and the know-how about Automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good news!
The REST API call inside the loop "For Linked Issues" was fired only once and I managed finally to update the custom field 'Progression' with the average calculation.
That was a really long journey.
Thank you @Bill Sheboy for all the good ideas and tips you have given.
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 that worked...particularly because as automation is improved I can imagine some alignment of features between Cloud and Server/Datacenter:
Have a great day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everyone,
I had this question a while ago, and now I'm having a similar problem. I need an Epic field to average for the same field as Epic tasks.
I tried using:
{{issue.storys.Progresso(%).average|0}} or {{issue.tasks.Progresso(%).average|0}} but it didn't work, does anyone know how to do this automation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using the Jira Cloud or Server/Data Center version of automation?
For Cloud: use a Lookup Issues action with JQL to find the child issues of the epic, and then use the list function average on the results
For Sever/Data Center: use a branch with the bulk-handling enabled...with the same JQL to get the results.
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.
Hi @Bill Sheboy
I'm using Jira Cloud. What smart value can I use to find the child issue of the epic, so far I can only search the epic from a child and not the other way around.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The JQL you need depends upon the triggering issue...
If the epic is triggering the rule, its key is what you need. To find the children try this JQL:
"Epic Link" = {{triggerIssue.key}}
If instead a child of the epic is triggering the rule, you use that child's epic link to find the others, and then branch to the epic for the update. The JQL to find the sibling children is:
"Epic Link" = {{triggerIssue.Epic Link}}
The above are for a company-managed project (which uses Epic Link to conned epic/children). If this is for a team-managed project substitute parent for Epic Link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy , using this way I've made some progress but I still can't get the average of the values.
This is my situation at the moment
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To make the edit, you now want to use the lookup issues result as your source for the issues:
{{lookupIssues.Progresso(%).average|0}}
If that does not work due the the name of the custom field confusing the rule, try to use the custom field id name instead. You may find the name using this how-to article:
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Bill Sheboy it really works and the article is very good, but for some reason I am not able to open the URL of the issue to better understand how to get the smartvalues I will check if it is a restriction of the company's connection. By the way if the trigger of the rule was a subtask within a task that is inside Epic, how could I activate the rule? I was thinking about this because subtasks don't have the Epic Link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For a subtask triggered issue, you would need to walk up two levels: first identify the parent of the subtask, get that issue to then find the epic link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy I tried doing it this way but the calculation didn't work for epic.
I tried to make everything one rule.
I used for parent: {{issue.subtasks.Progresso(%).average|0}}
And for Epic: "Epic Link" = {{Issue.parent.Epic Link}}
Like the picture.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It appears you are performing that lookup issues inside of the branch on the parent Epic, and so when it references {{issue.parent.Epic Link}} I do not understand what that could be referencing...and apparently neither does the rule.
That would be something like: for the Epic > parent > Epic. Which is probably not what you wanted.
To help clarify what you need in a rule, would you please answer:
Knowing that will help make a rule to meet those needs. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Really this rule doesn't get you anywhere, I modified it earlier.
Well I can do both calculations well but the problem is still the trigger is the subtask since there is no epic link.
I am currently using the following structure:
In lookupissue: "Epic Link" : {{issue.parent.Epic Link}}
And for Branch JQL: Issuetype = Epic AND "Epic Name" = "{{issue.parent.Epic Link}}"
but isnt work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your JQL in the branch is trying to match on Epic Name and you want to use key in order to get the epic:
issueType = Epic AND key = {{issue.parent.Epic Link}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Its work Thank you , its the first time that i work with the Epics but i understand more now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey guys,
I'm reactivating this question because for some reason the rule stopped working, showing the error below:
Have there been any recent changes to the Jira schedule?
Note: The rule is the same as the image above, with only the change suggested by @Bill Sheboy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This seems related to the changes for epics, sunsetting things like "Epic Link" and replaced by parent.
Let's try this...using example issues, try running your JQL manually with advanced issue search. That will confirm if your site is now using the parent field. Then adjust the JQL to work correctly, and finally update your rules.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Using advanced search I can't find it anymore "issue.parent"
In this case, value do I have to put to find the epic where the subtask is?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, I was not more clear...
In a rule, you can see {{issue.parent.some field}} because the rule is loading both, but that is not the case with JQL.
Instead, find an example issue that would have been {{issue.parent}} and then see which field is available: parent or "Epic Link". Then use that information to identify the smart value for the rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
I don't know if I understood correctly, but the field available to me when I search for this type of item is "Epic link"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry the message above ended up being sent incomplete.
I believe it should work, I searched the jira documentation and the smart values used are valid....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you write the smart value to the audit log, what do you observe: the correct value, an empty value, or something else?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do I do this in the audit log? In this section I can only view the rules and the result of their executions...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can add the Log action to your rule with the smart value, as this can help to provide diagnostic information as a rule proceeds.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Guilhem Dupuy , Thanks for reply.
Its very dificult to belive that dont have how to do some so simple, isn't there how a code in Json that can do that?
I already is using a paid Add-on to show better the board of Jira, and now to pay another Add-on for do this, will getting very complicated to use the software if always we need of something buy a Add-on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.