Forums

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

Not able to fetch and make average of values in issues of lookupissues in automation

Bhuushan Jaju March 20, 2025

I have an automation to run
wherein
I have portfolio epics, and epics as child task of PE
I have number field in both: Say A for PE and B for Epic

I want to make average of B and give it to A
How can I make it?
I have tried in staging environment, but I am not able to fetch the lookup issues to have their field value to make average

2 answers

Suggest an answer

Log in or Sign up to answer
1 vote
Akhand Pratap Singh
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.
March 21, 2025

Hello @Bhuushan Jaju ,

As per my understanding you want average of "Number field" of Epic and display that in PE Number field.

You can achieve this by Automation for Jira.

In which you can have 2 Automation with triggers based on whenever Field Value change and whenever there is changes in the Child Parent relation (like Epic is added or removed from PE)

or you can schedule it to run once everyday.

Automation should look like below.

1. Have a lookUp issue to identify all associated child to a Parent.

"parent" = {{triggerIssue.parent}}
LookUp issues.png

2. Then Create a Variable to count number of Child in Parent ticket
{{lookupIssues.size|0}}

Number of child.png

3. Now for create a Branch and select for Parent. and edit the Number Field Custom field.

Avergae of Number field value for Parent should be{{lookupIssues.Number Field.sum}}/{{Issuecount}}

a. Here Number Field is my Custom field name

b. {{Issuecount}} is variable I created in step 2

Edit parent.png

 

This should work to Calculate Average

Bhuushan Jaju March 23, 2025

Hi @Akhand Pratap Singh ,

Thanks for your answer, a change is I am in data centre environment and somehow I am not linking PE with Epic as parent child directly, instead I am just using link issue with link type "is child task of" for Epic.

So Epic appears as "is child task of" PE.
Could you please let me know how can I put write query for fetching those Epic?

0 votes
Vishal Biyani
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.
March 22, 2025

@Bhuushan Jaju 

if you are on JIRA Cloud then to get the average of a field below will work. The result can be saved in a variable say varEpicBAverage

{{lookupIssues.customfield_xxxx.asNumber.average|0}}

asNumber takes a string and converts it to a number (if possible)

For testing, you can define lookup action with a manual trigger as

parent = {{ issue.key }} or parent = {{ triggerIssue.key }}

and then execute the rule for PE.

With lookup the focus has shifted to Epics, so you can branch to parent

Then add an action of Edit to update PE field of A using smart value varEpicBAverage.

Let me know if this works for you

Note: on JIRA DC version as far as I understand lookupIssues does not support all custom field

TAGS
AUG Leaders

Atlassian Community Events