Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get sum of custom field value in case the key of project ex.(xxx) by groovy

Haitham Refaat
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!
June 13, 2019

The project key is (xxx) based on the key will get SUM of custom field value in looping how to execute this.
This code below:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
def total = issue.get("Effort Remotely (h)")
double totalSum = 0;
if(issue.getRawValue("customfield_14537")?.value == "AAA")
{
if (issue.get("project")?.key == "XXX"){
totalSum += total.toDouble()
}
}
return totalSum

1 answer

0 votes
Nic Brough -Adaptavist-
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.
June 16, 2019

You will need to add code to that to search for a list of issues (ideally based on "project = XXX", to minimise the size of the search) and iterate over them, reading the custom field value for each one.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events