How to sum up logged work

Denis November 1, 2021

Hi together,

is there any way to consolidate spent time in an epic.

1st Problem

I tried to branch the automation by using For epic (parent) and inserted "{{issue.subtasks.aggregatetimespent.sum}}" but that always reply 0. Even if I see by using the Rest Api that there is a value in it.

2nd Problem

Even if I have the summarized time spent. Where to store it? I want to have it visible in the time tracking field available in my epic.

 

So I want to realize by automation the checkbox Jira introduced for standard issue types "Including Subtasks" but here as "Including standard issue types"

 

//edit 02.11.2021

I tried even more potential smart values, and all reply "0". I tried it now with the action Lookup issues, and for Story Point sum it works.

 

All reply 0:

{{lookupIssues.worklog.timeSpentSeconds.Sum}}

{{lookupIssues.aggregatetimespent.sum}}

{{lookupIssues.timespent.sum}}

{{lookupIssues.timetracking.timeSpentSeconds.sum}}

 

2 answers

0 votes
Vinod Kotiya May 12, 2023

This really helped me to get time spent of sub-task under lookup value in Automation

 

{{issue.subtasks.timetracking.timeSpentSeconds.sum}}    <<< For sub-task Time Spent

{{worklog.timeSpentSeconds.sum}}    << for task Time Spent

 

Adding both I got rollup at Task which is similar to Aggregate (Sigma) Time Spent 

0 votes
Denis November 2, 2021

I found a solution but it's quite hacky.

 

I use the action "Send web request" with the following values:

.../rest/api/latest/search?jql=%22Epic+Link%22%3D{{issue.epic link}}&fields=aggregatetimespent

Headers:

  • Field1: Authorization
  • Field2: Basic base64encoded_e@mail.de:API_TOKEN (you must encode e@mail.de:API_TOKEN as base64 string)

HTTP method: GET

Web request body: empty

Wait for response:

  •  Delay execution of subsequent rule actions until we've received a response for this web request -> "check"
  • Continue running the rule even if the request response is not successful (i.e. non-200 response) -> "false"

 

After a successful request you can use the following statement to sum up all aggregates timespent of standard issue types except epic. So it's only working for items like story, bug, ...) But that's no problem because you can check include subtasks in the standard issue type and then the value is included in aggregatetimespent.

{{webhookResponse.body.issues.fields.aggregatetimespent.sum}}

 

Quite hacky and sadly you need login credentials from a user for that. But I didn't found any other way, because I can't access aggregatetimespent by smart value.

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.
November 2, 2021

Hi @Denis 

The Lookup Issues action only supports a small number of fields currently, and does not support those time tracking fields.  I believe using the REST API is one of the only ways to do this currently from within a rule.

The other way is to trigger on child issue changes for the fields, adjusting custom fields in parents with each change.

Kind regards,
Bill

Like Denis likes this
Denis November 20, 2021

Thanks for you answer, Bill. :)

Then I will go with the rest api.

David Ashlock November 23, 2021

Thanks for sharing @Denis -- between your info and this page:

https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828

I was able to get it working for multiple custom fields on the Task issues that I wanted to roll up to the Epics.

Like Denis likes this
Rodolfo So February 2, 2024

@Denis 

 

Can you able to share your screenshot for your automation rule? 

 

Thanks

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.
February 2, 2024

Hi @Rodolfo So 

This is a very old question / thread.  I recommend creating a new question and linking back to older threads for context.  That will ensure more members of the community see the question to offer help.

Until you post your new question...

The capabilities of rules have changed quite a bit since November 2021...

  • For Jira Cloud, the Lookup Issues action can now provide all of the issue fields, making sums easy.  Just provide the JQL and then sum the relevant fields from the {{lookupIssues}} result.
  • For Jira Data Center, it has the Lookup Issues action, but only some of the fields.  The original suggestion of using Send Web Request to the REST API issue search still works.
  • For Jira Server, I believe it does not have the Lookup Issues action.  And so only the Send Web Request is the only option.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer