How to get sum timespent from linked issues?
Asked by Pavel:

Hi, I'm trying to calculate total timespent of all worklogs for linked issues (is caused by for ex.) using smart values.

This one gives me a list of linked issues:

```
{{issue.issuelinks.outwardIssue}}
```

This one gives me total amount of timespent from their worklogs (in seconds):

```
{{issue.issuelinks.outwardIssue.timespent}}
```

It works perfect and returns one number until there becomes more than one linked issue.

If parent issue has 2 linked issues it returns string of values separated by comas:

3600, 2400 ...

How can I sum these values to get one number (6000 for ex.)?

Tried to add .sum" but it returns nothing:

```
{{issue.issuelinks.outwardIssue.timespent.sum}}
```

UPD: audit logs:

**Logaction**

Parent issue (is caused by) list issue.issuelinks.outwardIssue.timeoriginalestimate: **3600, 7200**

**Logaction**

trying to get sum issue.issuelinks.outwardIssue.timeoriginalestimate.sum:

\^this one is my current problem, it's empty

**Log work**

This work duration obviously terminates:

```
{{#=}}({{issue.issuelinks.outwardIssue.timespent}}-{{issue.timetracking.timeSpentSeconds}})/60{{/}}m
```

Error rendering smart-values when executing this rule:Too many numbers or variables: (1920, 5400-3720)/60


Answers:
author: Sherry Goyal
body: [@Pavel](/t5/user/viewprofilepage/user-id/4072576) Hello!

Thanks for writing to us.

If you are using **cloud(not jira server)**, then "sum" should work the way you are trying to do. I used

```
{{#=}}{{issue.issuelinks.outwardIssue.timespent.sum}} / 3600{{/}}
```

This gave me sum in hours.

It would be better if you can share audit logs and rule plan for better insights.

Let us know in case of concerns.

Cheers  
Sherry(A4j)

comments: author: Pavel
body: Thanks for quick reply. Yeah, i'm on server version. Updates post with logs, can't paste images due to net rules restrictions. Is there any solution for server version?


author: Sherry Goyal
body: [@Pavel](/t5/user/viewprofilepage/user-id/4072576)

I do see [request](https://jira.atlassian.com/browse/JIRAAUTOSERVER-75) for sum/min/max, etc raised in the backlog with the relevant team. I have voted for the request. Also, have notified the team with your concern. Hopefully somebody will respond here soon.

Cheers  
Sherry


author: Victor Seger
body: Hi [@Pavel](/t5/user/viewprofilepage/user-id/4072576) ,

I'm Victor from Atlassian Support. I'm one of the experts about Automation for JIRA.

So, currently there's no way of performing this action as you wanted. The workaround that [@Sherry Goyal](/t5/user/viewprofilepage/user-id/3873899) is the closer that we can get from what you wanted to do.

Automation for JIRA would need to have variables and aggregate functions that are not currently available on our Server version of the plugin.

Sorry for not bringing you good news at this point.

I've updated the [request](https://jira.atlassian.com/browse/JIRAAUTOSERVER-75) that Sherry sent you previously to add the "aggregate" function as well.

I'd suggest you voting and watching that case so you're going to receive updates when they happen on that ticket.

Hope it all makes sense.

Cheers,  
Victor


Tags: jira-server