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

How to use automation to sum up in EPIC the hours logged in child tickets ?

Pierre Allard
Contributor
February 24, 2022

Hello all !

I'd like to do exactly what the title says.

So according to the details from this article https://community.atlassian.com/t5/Automation-articles/How-to-sum-up-logged-hours-using-automation-in-Jira-Cloud/ba-p/1409115

I've set up the rule below:

Sans titre.png

But in "Audit Log" I got error below :

  • Log work
    • Error trying to log work against an issue
    • Worklog must not be null., You must indicate the time spent working. (timeLogged)

 

Then I've tried the to set up the rule below

Capture d’écran 2022-02-24 100046.png

But I've the same error.

Do you happen to have an idea of the problem ?

Thanks a million in advance for your help !

Pierre.

8 answers

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2022

Hi @Pierre Allard ,

As the article mentioned in your question already points out: it´s not that straight forward with epics. Issues within an epic can not be pointed at directly via "child" connection.

In case it´s about stories/issues directly in an epic I solved this with a "lookup issues action" in between --> see screenshot

image.png

Please let me know if this helps.

Best
Stefan

Pierre Allard
Contributor
February 24, 2022

Hello Stefan,

 

Here's what I did in my rule and that works very well ! :)

Capture d’écran 2022-02-24 161439.png

Thanks a lot for your help!

 

Best.

Pierre.

Like # people like this
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2022

You are welcome @Pierre Allard 

Please be so kind and accept the answer in order to this question appears solved which helps other users in need for the same information find that solution more easily ;)

Best
Stefan

Brinda Tailor July 14, 2022

@Pierre Allard 

Can you please let me know what you wrote in the Date started field?

 

Thanks,

Brinda

Screenshot 2022-07-14 145142.png

Like Erika Simon likes this
Erika Simon April 19, 2023

I have the same question. I believe it's {{now}} based on Pierre Allard's Feb 24, 2022's screen shot above, but I still can't get it working.

1 vote
Hila Ben Halevi May 1, 2023

Hi @Stefan Salzl ,

colud you please instruct me ho

0 votes
Stephan Hannach
Contributor
July 5, 2024

To complete this post: the feature request for this function: https://jira.atlassian.com/browse/JSWCLOUD-17275

0 votes
kasimv_webelight February 28, 2024

Hello all!
I just want to do the sum of all user work logs for tasks, sub-tasks, bugs, and improvements for the last week. trigger this event on Saturday and this should be for all the users inside my Jira and send this sum of individual user work logs and send the message to individual users on Slack. so is it possible to use Jira automation?

0 votes
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 post and the comments, all. 

I have noticed many articles like this BUT it seems either something is missed or it is flying over my head :D

With 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?

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 11, 2023

Here is a screen grab. 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. i.e expecting the Epic to have the same work log total as the child issues, but the Epic simple appends the total that is added, updated and delted as well.

Hope that helps in helping me :)

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

Thank you

0 votes
Hila Ben Halevi May 1, 2023

Hi @Stefan Salzl ,

Could you please instruct me how to sum up to epic the time spent with brunch or rest API, as you mentioned above?

 

Thanks,

Hila.  

0 votes
silfarney_zanatta April 12, 2023

Hi Guys, 

Do you know How do it for Jira Data Center?

Slava Gefen
Contributor
May 30, 2023

Hey @silfarney_zanatta , is your need still relevant?

Do you have Scriptrunner?

With kind regards
Slava

silfarney_zanatta June 5, 2023

Hi @Slava Gefen ,

Yes, I still need a solution and I have Scriptrunner.

Let me know your feedback.

Thanks in advance!

Slava Gefen
Contributor
June 5, 2023

Hey @silfarney_zanatta , great!

The last question! Do you want to sum up logged work in additional field, e.g. called Sum of Worklog, or do you want to use Native Worklog in Epics and make read-only?

silfarney_zanatta June 5, 2023

I would like add this information in Native Field "Worklog".

But I think that is better use a custom field if us will use Scriptrunner, right?

Slava Gefen
Contributor
June 5, 2023

Hey @silfarney_zanatta sorry for the delay.
I thought we could do without Scriptrunner, if you need to implement it in new issues. If some stories already have worklog, firstly we need to update Epics with actual data.

So it turned out that the Automation is pretty simple:

1. We start from Work Logged action

Capture1.JPG

2. Then we check that Epic exists 

Capture2.JPG

3. Then we go to Epic

Capture3.JPG

4. And finally add to Epic Work log that just was added to a Story

Capture4.JPGCapture5.JPG

After that in Epic worklog will be adjusted each time work logged in any Story:

Capture6.JPG

You just need to think if worklog is updated or deleted. In this case we can implement if-else condition.

Let me know if it's working for you 😉

With kind regards
Slava

Like # people like this
Slava Gefen
Contributor
June 5, 2023

@silfarney_zanatta and I forgot to mention, that you need provide work log permissions in Epic only for Automation user, if you don't want users to put worklogs in the epic by mistake.

Regards
Slava

silfarney_zanatta June 7, 2023

Thanks so Much @Slava Gefen

My last question, this solution will get only the Time Spent in Story right? (not get the information from Sub-task (belongs to story).

Note. I am using the Jira Data Center.

Slava Gefen
Contributor
June 7, 2023

Hey @silfarney_zanatta 

My last question, this solution will get only the Time Spent in Story right?

Yep, it takes Worklogs from all Story level issues to Epic. Do you want to provide from Sub-tasks to Epic also?

Note. I am using the Jira Data Center.

Yes, my screens are from DC 👍

Regards
Slava

Erika Simon June 7, 2023

Hey, @Slava Gefen Thank you so much! I will try this -- does it work for Jira Software too? (I see you worked this up for Silfarney_zanatta, who uses Jira Data Center.) I definitely want to include from subtasks to epic also. Thank you again, I will try this if you think it works also for Jira Software!

Erika

Erika Simon June 7, 2023

Scratch that, @slava_Gefen. I was able to make Hugh Lampert's suggestions above work for me in Jira Software. Thank you!

Erika

silfarney_zanatta June 7, 2023

Hey @Slava Gefen , yes I need get the information from ALL Stories and Sub-tasks.

Thanks again.

Slava Gefen
Contributor
June 8, 2023

@silfarney_zanatta sorry for the delay!

yes I need get the information from ALL Stories and Sub-tasks.

In this way which behavior you are expected when a worklog was added to a sub-task?

Do you want to add it to Sory's worklog and then go up and add to Epic's?

Or just go two levels up to Epic and add there?

Slava Gefen
Contributor
June 8, 2023

@Erika Simon hey, yep in Cloud version it's much easier!

Regards
Slava

silfarney_zanatta June 8, 2023

Hi @Slava Gefen , 

In this way which behavior you are expected when a worklog was added to a sub-task?

<Zanatta> In My it is possible I see the Total of Worklog hours in Story + Sub-task (into Story.  So my expectation is add the same view but in EPIC (get all worklog from Stories + Sub-tasks)

Do you want to add it to Story's worklog and then go up and add to Epic's?

<Zanatta> My expectation when a work log hours was added in a Story or Sub-Task, I would like show it in EPIC level.  (So we have today this feature to show the Total of Worklog into Story (Story + Sub-Tasks)

Or just go two levels up to Epic and add there?

<Zanatta> In my case I dont need add Sub-Task worklog in Story (because we have it today) but I need add it in Epic Level.

 

Note: I would like do the similar solution that we have in Jira Cloud using ({{issue.childissue.timeSpent.sum}}) . But it not works in Jira Data Center *.sum

 

I don't know if you got my point above.

Thanks in advance!

Slava Gefen
Contributor
June 20, 2023

Hey @silfarney_zanatta sorry for the delay I was away a little)

I don't know if you got my point above.

I hope I did.

So, in the rule above (This my comment )

we need to change the first condition with if-else block:

Capture7.JPG

And put everything else under it.

Then in else block you need to put this condition:

Capture8.JPG

Capture9.JPG

And then for the branch use JQL with this smart-value:

Capture10.JPG

For the worklog action use the same that we used in Story level.

Finally, you will see in Epic worklogs from Sub-tasks:

Capture11.JPG
Capture12.JPG

Let me know if you have any question.

Hope it helps!
With kind regards
Slava

Fabio Esteves da Silva Manzoni February 2, 2024

Hi @Slava Gefen

 

Can you help me please with this case below?

I did exactly the automation and it worked, but if I select a date different from the current one in the story it will set the current date in the epic. In automation I set the option "Copy Created from Trigger issue" and it still didn't solve the problem. Do you have any idea how to resolve this.

I confess that I also couldn't do the if-sel for the removal. Whenever I try it adds deleted value

Thank you very much. Fabio

Slava Gefen
Contributor
February 4, 2024

Hey @Fabio Esteves da Silva Manzoni , hope you are doing well 👍

I did exactly the automation and it worked, but if I select a date different from the current one in the story it will set the current date in the epic. In automation I set the option "Copy Created from Trigger issue" and it still didn't solve the problem. Do you have any idea how to resolve this.

I'm not sure I understand your need. Could you please share some screenshots what are you trying to achieve?

Thanks in advance!
Slava

Fabio Esteves da Silva Manzoni February 5, 2024

Hi Slava,

Thank for your help, below are the prints.

I registered in the Story worklog January 30th at 9 AM. The automation worked, but in Epic it registered on February 2nd at 10:50.

Fabioepic timesheet automation.pngepic timesheet epic.pngepic timesheet story.png

 

 

 

Slava Gefen
Contributor
February 6, 2024

Hey @Fabio Esteves da Silva Manzoni 

What is your initial trigger?
Maybe just put {{now}} smart-value as a 'Date Started' value to log the same date?

Thanks
Slava

Fabio Esteves da Silva Manzoni February 6, 2024

Hi @Slava Gefen

 

Setting the condition {{now}} in data started it takes the current system date and time and not the date and time selected by the user.

 

Thanks, 

Fabioautomation configuration.pnglog work epic.pnglog work story 2.pnglog work story.png

Slava Gefen
Contributor
February 6, 2024

Hey @Fabio Esteves da Silva Manzoni I got, a user can set the 'Started Date'

Then try please this smart-value 👇

{{worklog.started}}

Thanks
Slava 

Fabio Esteves da Silva Manzoni February 6, 2024

@Slava Gefen

 

Worked. 

Thank you so much.

Fabio

Like Slava Gefen likes this
0 votes
Brellison April 26, 2022

@Pierre Allard Have you come across the issue of the automation double counting time spent entries?

For example, if I enter 1h of work on a task within an epic, the epic will show 1h. However, if I enter another 1h of work on that same task or another task within the epic, the epic shows 3h. Which makes me believe it counts the previous entries every time.

Sehreen Jafry
Contributor
July 19, 2022

@Brellison Running into the same issue here. Every time the automation runs, instead of 'over-writing', it adds a new worklog to the previous one hence adding to the previous value.

One workaround would be to delete the previous worklog on epic level before running the rule.

Pierre Allard
Contributor
July 19, 2022

Hi @Brellison @Sehreen Jafry

You're right, I've faced the same problem. But it seems that automation rule cannot delete worklogs...

Sehreen Jafry
Contributor
July 19, 2022

@Pierre Allard 
Yeah so I ended up just manually deleted the previous worklog before running this particular automation rule.

That's the only thing I can think of at the moment, till there can be a way to delete the worklog via automation first and then run the automation to sum up the logged hours and save on the EPIC level.

Hugh Lampert
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 10, 2022

Since the work log, IS a rolling work log and you can't delete existing entries through automation, the answer is to check if the sum of the timespent in the exisiting  entries in the EPIC log equate to the sum of the timespent on all the child tasks before adding a new entry to the EPIC.  If the time spent on the EPIC is less than the time spent on all the child tasks, add a new entry to the epic with the difference:

 

JiraUpdateEPICTimeSpent.png

Like # people like this
João Vitor Maurício de Abreu
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 12, 2022

Nice work @Hugh Lampert!

I would only divide by 3600 instead of 60, I think you're maybe logging in minutes when they should be in hours. I can't tell if that's how it should work for you because I use Tempo Timesheets, so I just changed this and it worked very well.

Like # people like this
Pierre Allard
Contributor
October 24, 2022

Thank you very much @Hugh Lampert , that works very well ! :)

Manish Bhardwaj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 20, 2023

I am not using Jira cloud, its Jira Data Center. So there is no "LookupIssues". What's the alternative in that case?

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 20, 2023

Hi @Manish Bhardwaj 

depends on your specific requirement but in general I see 2 ways to do:

  • creating a branch with a jql branch or
  • add a "send webrequest" action that does a JQL

Best
Stefan

Ilidio Faria April 19, 2023

@Hugh Lampert do you mind to post the JQL of the automation in text were?

Erika Simon April 19, 2023

@Hugh Lampertthis is genius. But in the very last step (Then: Log work), what should be entered for the required field "Date Started"? Please see screen shot. It's not working for me, and I think it's because I don't know what to put into this field. log work date field.png

Hugh Lampert
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 19, 2023

Regarding what to put in the "Date Started"  field:

The "date started" field can be left as "{{now}}".

If this isn't working for you and you have "{{now}}" in this field, then there is some other problem; check the evaluation log.

Erika Simon April 19, 2023

Thanks @Hugh Lampert for your quick reply. Where will I find an evaluation log? I'm using {{now}} and it isn't working. I'm not getting any errors, but the time logged on children does not show up on epic.

UPDATE to my 4/19 note -- it's now working for me! Thank you so much, @Hugh_Lampert!

Ilidio Faria April 20, 2023

@Hugh Lampert also not working were. Can you please export your automation to a JSON file? In my case you can find here the log2023-04-20_09h16_48.png

Ilidio Faria May 2, 2023

@Hugh Lampert can you help with the issue above?

Slava Gefen
Contributor
June 7, 2023

@Manish Bhardwaj hey ✋

I am not using Jira cloud, its Jira Data Center. So there is no "LookupIssues". What's the alternative in that case?

You can try my solution for DC above (Now it describes create worklog only).

Regards
Slava

Like Gazaliy Alade likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events