Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to sum up logged hours using automation in Jira Cloud

52 comments

Martyn Henderson April 30, 2021

Hi @Sherry Goyal 

Thanks so much for your help with this one! 

So I have a rule set up to update OE sum from sub-tasks to stories which is working fine

And I set about on a rule to do the same from stories to Epics as per your workaround suggestion above, but nothing happens in the Epic record

{{#=}}({{fieldChange.to}} - {{fieldChange.from}} + {{issue.original estimate}})/60{{/}}

Sketch (1).png

But I do get a success message

Sketch (2).png

 

Any ideas please?

Thanks very much

Martyn

Yvan Martin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2021

Hi there,


Developer from Automation here.

We currently have an issue with field value time tracking not working with log time tracking fields: https://codebarrel.atlassian.net/browse/AUT-2171


As an workaround for log time actions you'll now need to use Work logged with {{worklog.timeSpentSeconds}} instead of using from/to, an example of updating the epic's original estimate would use 

{{#=}}({{issue.timetracking.originalEstimateSeconds|0}}-{{worklog.timeSpentSeconds|0}})/60{{/}}

 

Screen Shot 2021-05-04 at 12.25.29 pm.png

 

You might need to change the above branch/condition with parent link, or sub-task, depending on the relationship.



If you need also want original estimate changes on the child to update the parent, you'll need a second rule with field value changed trigger on time tracking

Screen Shot 2021-05-05 at 5.02.32 pm.png

{{#=}}({{issue.timetracking.originalEstimateSeconds|0}}+({{fieldChange.to|0}}-{{fieldChange.from|0}}))/60{{/}}
Christine Corona May 28, 2021

@Sherry Goyal @Yvan Martin  Good Afternoon,

Now that I've spent endless hours trying to leverage the information provided to perform this same function with linked issues with no success, I'd like to graciously reach out for your assistance. 

Use Case: Aggregately update Time spent field for an issue (in project A) based on the Time spent data entered on the linked issues (in project B). I do not need Original Estimate updated in project A as that information is input independent of what is input on the linked issues in project B. 

Any guidance you can provide would be appreciated. I've also tried using ScriptRunner for Jira Cloud but I'm quite the novice and cannot successfully write a script without the simple prompts provided by Automation for Jira. 

Thank you,

Christine

Youssef El Hirech July 27, 2021

Hello,

I've tried everything from this topic, it work to add values in comment like @Santiago  said, for RemainingTime and Original Estimate, but :

  • When it's update in the Details, it's not working for the Original Estimate, when i got half hours in my subtask, this error happen :

(Specify a valid value for the original estimate (timetracking_originalestimate))

When i got only hours in my subtask, it success, and work fine without any error.

Any idea why it's not updating Original Estimate in the Details ?


{
"fields": {
"environment": "Merci d'avoir signalé {{issue.key}}.",
"labels": [
"bugfix",
"blitz_test"
],
"timetracking": {
"originalEstimate": {{#=}}{{#=}}{{subtasks.timetracking.originalEstimateSeconds.join(" + ")}}{{/}}/3600{{/}}
}
}
}

 
Regards,

Mike M August 18, 2021

@Sherry Goyal I am having the same issue @Kevin Brung  was describing but have not found a solution. 

Here is what Kevin wrote.

"Here's my rule, it doesn't work and I don't know why.

I try to sum Original Estimate of Sub-Tasks into parent Task.

It's never triggered when I modify the Original Estimate field on a subtask.

Could you please help me?"

Rule.PNG

Like Tomas Penka likes this
Mike M August 18, 2021

@Yvan Martin can you review my question above? Still stuck on getting the rule to work. 

Pierre Allard January 3, 2022

Hello @Maria Yacoub 

I'm trying to do what you explained in your comment from Jun 18, 2020 but it seems that smart value below does not work for me.

{{#=}}{{issue.childissue.timeSpent.sum}} / 60{{/}}

Indeed I get below error:

Log work

Error rendering smart-values when executing this rule:
Unknown unary operator / at character position 1: / 60

Could you please let me how you have impleted the rule to get in an epic the sum of worklogs of its children ?

 

Thanks a lot in advance !

Pierre.

Pierre Allard January 21, 2022

Hello @Sherry Goyal

I'd like to do exactly what the title of your article says, i.e use an automation to sum up in en epic the hours logged in children tasks.

So I've set up the rule below

Sans titre.png

But the rule fails with this error :

  • Log work
    • Error rendering smart-values when executing this rule:
    • Unknown unary operator / at character position 1: / 60

Do you happen to have an idea of the problem ?

Thanks a million in advance for your help !

Pierre.

Like Tomas Penka likes this
Tomas Penka July 27, 2022

Hi @Sherry Goyal

 

I've followed this topic to set automation and be able to sum all Log hours in child task and write those hours as the total number subtracted from the Remaining hours of the parent Epic.

 

I am solving two issues:

1) I can't trigger the automation of the following field values and don't know why. It works and send me testing email when changing Status or Assignee, but when logging hours, changing time tracking,... nothing happens. Do you know why?

 

trigger_does_not_work.jpg

 

2) I don't know if I can write the total sum of tracked hours of the child issues into the parent Epic (tracked hours) because the previous code does not work for me. My idea was simply duplicate the Log work from the triggered task and write the same worklog to the epic. The trigger will call the automation when someone create a new worklog. Can this work? I got these errors

 

logwork_automation.jpg

 

errors.jpg

 

 

Many thanks for any tip. 

 

Have a great day,

Tom

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2022

@Tomas Penka Hi!

The field value change trigger does not work anymore now(Sorry about that). Here is the ticket where we are tracking it: https://codebarrel.atlassian.net/browse/AUT-1648

Meanwhile, you can try using the work logged trigger - there is a workaround mentioned here: https://codebarrel.atlassian.net/browse/AUT-2171. See if this helps you!

Happy Automating!

 

Thanks
Sherry

Like Tomas Penka likes this
pedro_pizarro_bip July 28, 2022

Hi, I hope this topic page is correct.

I need to sum the logged time of the subtasks and report the result in the logged time of the story. So that the time tracking values of "remaining estimate" of the story will be updated automatically. I already have tried many automations but no one is working.

remaining-estimate-automation.GIF

 

Thanks for the answers

Tomas Penka July 28, 2022

Hi everyone,

 

I am sharing my automation how to do this scenario:

 

1. Someone log work in child issue

2. this worklog will be automatically added to the parent epic with the comment of the worklog, link of the child issue and timespent

 

It means you don't need to sum up the total time and calculating total in Epic task but everything is done automatically in real time once anyone log any work.

 

Timespent: {{#=}}({{worklog.timeSpentSeconds|0}})/60{{/}}

Work description: {{worklog.comment}} - {{triggerIssue.url}}


Only keep in mind that the yellow If: all match conditions for giving-back task and the parent = DA-2546 is my testing epic and internal condition - delete it. 

 

automation.jpg

 

I can highly recommend to set Action: Send email to your e-mail address instead of the final desired action to be able to test if your scenario works or not, due to lots of bugs in JIRA automations. Good tip is also to all the variables (smart values) into the body of the testing email to be able to see what data are inside.

 

Thanks to @Sherry Goyal for a great article and good luck!

Tom

Like Sherry Goyal likes this
pedro_pizarro_bip July 28, 2022

@Tomas Penka thanks so much for ur quick answer but still I have a problem even if i didn't received any email (after activated the option).

last-config.GIF

Unfortunately I can see the time logged in the story only with the option "include subtasks" (but ofc isnt correct for what I need)

error2.GIF 

Any idea about possible solution? @Sherry Goyal 

Thanks :) 

pedro_pizarro_bip August 1, 2022

Hi guys, anyone can help me please?

Thanks

Pedro

Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2022

@pedro_pizarro_bip 

As I already mentioned above, the field value change trigger does not work as expected on "log work" and "timetracking" fields the way you are using in the above screenshot(Sorry about that). Here is the ticket where we are tracking it: https://codebarrel.atlassian.net/browse/AUT-1648

Meanwhile, you can try using the work logged trigger - there is a workaround mentioned here: https://codebarrel.atlassian.net/browse/AUT-2171

pedro_pizarro_bip August 9, 2022

Hello, @Sherry Goyal  thanks for you answer. Are u talking about this workaround? In this case I already tried but still not working.image-20210517-012219.png

Sven Fischer December 16, 2022

Hi,

indeed I'd like to sum up my subtasks "Original Estimate"s to their parent, too.

On execution unfortunately I get the error message:

Error editing issues
XQI-1101 (Setting both Original and Remaining Estimate is not supported in Legacy Mode. (timetracking))
Automation-Snom-JIRA1.png
Even though I'm just editing the "Original Estimate":

Automation-Snom-JIRA2.png
Actually the "Time Tracking Legacy Mode is: ON", if this is important? And yes, it's not in the cloud, but datacenter.

Anyone can give me a hint how to resolve this issue?
Thanks a lot!
Remya Ramakrishnan March 1, 2023

Sum up sub task estimates to task automation.jpgHello Everyone, I tried setting up Automation as specified but its not found working, when i change Orig Estimates of Sub Tasks, its not rolling up to Task. I am using Standard Jira License, are there any pre requisites required to enable this automation. Thanks in advance!

Nancy Tcheou April 17, 2023

I am also having the same issue with my set-up. It's set up as a global rule and I am not seeing that it is working for Epics with Tasks that have estimates. My Default unit for time tracking = Hour.

SCR-20230417-jzt.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.
April 17, 2023

Hi @Nancy Tcheou 

You note Epics and their child Tasks, however your rule is showing summing on sub-tasks.

When you want to sum the values for the child tasks, please try using the Lookup Issues action instead, perhaps like this:

  • trigger: issue created
  • action: re-fetch issue
  • condition: issue type is Task
  • condition: parent exists
  • action: lookup issues with JQL to gather the Tasks with the same parent
    • project = myProjectName AND issueType = Task AND parent = {{triggerIssue.parent.key}}
  • branch: to the parent
    • action: edit issue to use the lookup issues value
      • {{lookupIssues.Remaining Estimate.sum.divide(3600)}}

Kind regards,
Bill

David Leal
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.
August 22, 2023

@Sherry Goyal thanks for your post. I have the following use case. to update the original estimate of an epic when any child issue has changed the original estimate value by updating the original estimate of the epic, summing all original estimates from the children's issues. It seems that is the use case you are referring to, but in your example, you use:

{{#=}}{{issue.subtasks.remaining estimate.sum}} / 3600{{/}}

I am wondering if this works for this scenario, first, you are updating the remaining estimate, and I would need to update the original estimate only, and second, you iterate over all subtasks, which is not my case, I just want to sum up the original estimate of the epic children, not the information at the subtask level.

 

Any help on this?

 

Thanks,

David

Yatish Madhav
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.
October 9, 2023

Thanks for the article and the comments, all. 

I have noticed many post like this, though it seems something is missed or it is flying over my head :D

With trigger Issue created this doesnt work well. And for trigger Work logged for all operations, does the update or delete of task worklogs reflect on the Epic? I noticed that if it is updated, the new time is added to the epic and if existing worklog is deleted, that same time is added to the Epic. Both of these seem incorrect. Also, it does not look like we can identify if it is added , updated or deleted.

Any idea please?

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.
October 10, 2023

Hi @Yatish Madhav 

Without seeing your complete rule, I can hypothesize the cause for the Issue Created trigger symptom...

That trigger can fire so quickly that the data is not yet available to the rule.  This can cause conditions, actions, etc. to not work as expected.

The work-around / fix for this is to always add the Re-fetch Issue action immediately after the Issue Created trigger.  This will slow down the rule by about a second and reload the data before proceeding with the remaining rule steps.

Kind regards,
Bill

Yatish Madhav
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.
October 10, 2023

@Bill Sheboy thanks for the reply - here is a screen grab. No, the add work log, update work log and delete work log all log the time additionally to the Epic where it should actually add/update/delete accordingly. 

Hope that helps in helping me :)

Screenshot from 2023-10-10 17-10-31.png

Thank you

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.
October 10, 2023

@Yatish Madhav -- I recommend creating a new question and linking back to this thread for context.  That will ensure better visibility to others to help.  Otherwise only those following this thread will see it.

When you do that, please include images showing your complete rule, details of the relevant actions/conditions/branches, and of the audit log details showing the rule execution.

And...try to clearly identify the symptoms versus what you expected to happen.  That will help target the ideas.  (e.g. I was confused when you noted the Issue Created trigger and now you indicate that is not this rule's situation.)

Thanks!

Like Yatish Madhav likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events