Community Announcements have moved! To stay up to date, please join the new Community Announcements group today. Learn more
×Hello Folks.
I am working on a company-managed project. I have created one custom fields 'percentage completion' for Epics which will show the progress of epics (depends on the task status to Done). The tasks are the child of epics in my project.
To manage this setup, I am using Jira automation rule. I create the rule and using the template {{#=}}{{#lookupWorkItems}}{{#filter(status = "Done")}}{{/}}{{size}}{{/}} / {{lookupWorkItems.size}} * 100{{/}}. The screenshot below shows my rule setup.
After I enable/activate the above rule, I see the epic percentage is getting calculated in the main page. But the problem is, I don't see the same value populated in the custom field 'percentage completion' at the side panel. See the screenshot below.
I checked for logs and I get this.
After this error log, I used the below template. Added parenthesis (***).
{{#=}}({{#lookupWorkItems}}{{#filter(status = "Done")}}{{/}}{{size}}{{/}} / {{lookupWorkItems.size}}) * 100{{/}}
Still the %age competition was not displayed in the side panel. In addition to this I am not getting the error logs anymore which is a hint that the rule is not even getting triggered. Here is the latest screenshot of the error log page.
I hope I gave all the required information, but still i anything else is required please let me know and I will share. All I want is - the %age completion should also show in the custom field of side panel.
IMPORTANT NOTE - If I manually enter the %age calculation while creating an epic, I see the value on the side panel.
Hi @HQRAZAHS
First thing: what source are you using for the smart value expression you tried for the percentage value?
I ask, as there are many unsupported and incorrect things in that expression. I recommend not using that source, and instead refer to the documentation from Atlassian for smart values: https://support.atlassian.com/cloud-automation/docs/jira-cloud-automation/
Next, to use the {{lookupIssues}} smart value the rule must first use the Lookup Work Items action. Otherwise, there is no data in the smart value.
And so an example rule to update an Epic custom field Percentage Complete when a child work item transitions status would be this:
{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+1{{/}}{{/}} ) / {{lookupIssues.size|0}} * 100, 0){{/}}
How that works is:
That will calculate the percentage by count of items. When instead one wants the percentage by the Story Point values, this would work:
{{#=}}ROUND( ( 0{{#lookupIssues}}{{#if(equals(status.statusCategory.name,"Done"))}}+{{Story points|0}}{{/}}{{/}} ) / {{lookupIssues.Story points.sum|0}} * 100, 0){{/}}
Finally, other cases...
Several things could impact the accuracy of the percentage complete. And thus either one needs to create multiply rules to calculate the value, or use a single rule with a Scheduled Trigger to periodically calculate the value. Those cases include at least these:
Some of these cases may be combined to reduce the number of rules.
Kind regards,
Bill
@Bill Sheboy Finally I have something in the Percentage Completion custom field in the side panel. I cant thank you enough for this support.. I see the audit logs also and it shows success. See below screenshots.
But I do have a question. I notice the expected outcome only for newly created epics. What about the ones which are existing from before? Do I need to do some extra stuff for them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Earlier I described creating a Scheduled Trigger rule to help when Atlassian has an outage. That rule may also be used to "catch up" existing Epics:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy can you please give me the rules on some of the other conditions you mentioned in your first comments. For ex. When a new child is created and added to an Epic, When an existing child is removed from an Epic, update the previous parent Epic's field.
Is there any documentation for this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bill Sheboy I was able to configure other scenarios as well. I just created similar rule with just editing the trigger type. So I am all set now.
Thanks a lot again!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @HQRAZAHS
As well as looking at the comment from @Jeroen Poismans , you could also consider using .multiply(100) rather than '* 100', and similarly for divide use .divide(lookupIssues.size):
See https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/ for other maths functions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @HQRAZAHS
If your goal is to see the % completion of child issues in a custom field of an Epic, you need to use smart values in the Lookup Issues action in order to retrieve that.
First, use Lookup Issues to get all child issues that are done
then create a variable a = {{lookupIssues.size}}
Second, use Lookup Issues to get all child issues
then create a variable b = {{lookupIssues.size}}
For the Edit Issue action, if your field percentage completion is a numeric field, here is a smart value: {{#=}} ({{a}} / {{b}}) * 100 {{/}}
If it is a text field: {{#=}} ({{a}} / {{b}}) * 100 {{/}}%
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.
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.
This part doesn’t make sense.
You trigger on the Epic, but the branch will take action on the parent of this Epic and not on the Epic itself (unless I’m misunderstanding your need).
I think you can delete this branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Duc Thang TRAN Can we have a short connect please? I can send you an invite as per your availability.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Duc Thang TRAN I made the correction. Here are the screenshots. But the problem still exists.
AUDIT LOG:
The rule is not getting triggered, don't see any entry.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @HQRAZAHS
The ticket that triggered this rule is an Epic?
You can try updating this Epic DIGCM-115 to see if the automation works perfectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I might be overlooking something, but before I'm testing further, could it be that your rule is missing a step? You are referencing lookupWorkItems, but I dont' t see the lookup step?
Can you start by confirming this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anyway,
Here is what the lookup should look like:
Also, use the lookupIssues smartvalue when referencing the search result, lookupWorkItems did not work in my example.
Let me know how this goes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeroen Poismans I pasted my new setup in my previous response to Duc. Could you please review and advise. I am using lookupIssues this time.
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.