I have a few custom fields where I have to update the total sum of the subtasks estimates as per some defined percentage. I have used the following formula:
{{#=}} floor({{issue.subtasks.Original estimate.sum.divide(3600).multiply(0.20)}} / 40) + "w " + floor({{issue.subtasks.Original estimate.sum.divide(3600).multiply(0.20)}} % 40 / 8) + "d " + ({{issue.subtasks.Original estimate.sum.divide(3600).multiply(0.20)}} % 40 % 8) + "h" {{/}}
I am getting this error:
Unable to parse expression floor(10 / 40) + "w " + floor(10 % 40 / 8) + "d " + (10 % 40 % 8) + "h" : floor(10 / 40) + "w " + floor(10 % 40 / 8) + "d " + (10 % 40 % 8) + "h"
I have also tried using the following:
{{#=}} totalQaHours = {{issue.subtasks.Original estimate.sum.divide(3600).multiply(0.20)}}; weeks = floor(totalQaHours / 40); remainingQaHoursAfterWeeks = totalQaHours % 40; days = floor(remainingQaHoursAfterWeeks / 8); remainingQaHours = remainingQaHoursAfterWeeks % 8; weeks + "w " + days + "d " + remainingQaHours + "h" {{/}}
For this, I am getting the following error:
Unknown operator ; at character position 18: totalPmHours = 14; weeks = floor(totalPmHours / 40); remainingPmHoursAfterWeeks = totalPmHours % 40; days = floor(remainingPmHoursAfterWeeks / 8); remainingPmHours = remainingPmHoursAfterWeeks % 8; weeks + "w " + days + "d " + remainingPmHours + "h"
And then for the final total value, I have used the following expression:
{{#=}} qaTotalHours = {{issue.QA Estimation.split("w").first.trim}} * 40 + {{issue.QA Estimation.split("w").last.split("d").first.trim}} * 8 + {{issue.QA Estimation.split("d").last.split("h").first.trim}}; saTotalHours = {{issue.SA Estimation.split("w").first.trim}} * 40 + {{issue.SA Estimation.split("w").last.split("d").first.trim}} * 8 + {{issue.SA Estimation.split("d").last.split("h").first.trim}}; pmTotalHours = {{issue.PM Estimation.split("w").first.trim}} * 40 + {{issue.PM Estimation.split("w").last.split("d").first.trim}} * 8 + {{issue.PM Estimation.split("d").last.split("h").first.trim}}; totalHours = qaTotalHours + saTotalHours + pmTotalHours; weeks = floor(totalHours / 40); remainingHoursAfterWeeks = totalHours - (weeks * 40); days = floor(remainingHoursAfterWeeks / 8); remainingHours = remainingHoursAfterWeeks - (days * 8); weeks + "w " + days + "d " + remainingHours + "h" {{/}}
Can you please suggest to me here, How I can fix this issue?
Hi @VT Jira
Without reviewing the specific errors you are observing, I suggest pausing to consider:
The Original Estimate or smart value {{issue.timetracking.originalEstimate}} is the human-readable value, containing the units of measure. For example: 1d 4h. That value can be difficult to parse as a number in math operations.
The Original Estimate Seconds or smart value {{issue.timetracking.originalEstimateSeconds}} is just the number of seconds, and is likely the one you should use for math operations.
Please use the number value originalEstimateSeconds and adjust your calculations before proceeding.
If you are still encountering challenges, please images of your rule, rule actions, and of the audit log details to provide context for the symptoms.
And also...I recommend review the how-to article below as it can help become familiar with names and structure of supported smart values in rules:
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
Hi @Bill Sheboy
Thank you for your prompt response.
I have implemented a rule to automatically update the original estimates, remaining estimates, and story points of a parent task whenever the original estimate of a field type subtask changes. This calculation is based on the sum of the subtasks' estimates. Previously, this rule functioned as expected, and I was able to successfully update the relevant fields.
However, upon adding custom fields for PM/SA and QA estimations, I encountered the error described in my previous query. These custom fields use the same structure (w, d, h) and update logic as the original estimates.
Attached are screenshots of the rule and rule action for your reference.
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 have sorted out above. But now I am getting another issue.
I have used the following syntax for conditional rendering of estimates in custom fields:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could use the diff() function's prettyPrint format to do this for you automatically: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-difference---
For example, adding any number of seconds to {{now}} and differencing it with the original value:
{{now.diff(now.plusSeconds(some seconds)).prettyPrint}}
In your scenario, "some seconds" would be your adjusted value.
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.