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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Task issue

I have created an issue  as task type in jira that issue type i have linked another issue types  under same issue i have linked different issue types in that issue types i have some calculated fileds in that linked issues that all calculated values need to calculate automatically  and update in parent issue.please any one help me how to implement this logic in jira

2 answers

Hi @Madhu welcome to the Atlassian community forum.

If I understand your query correctly, you have created an issue type (let me assume it as a " "story" OR "bug"). To that "story" or "bug" issue type you have linked another issue type (let me assume it as a "sub-task"). So, you have linked multiple "sub-tasks" to the "story OR bug". Now you have some calculated fields (let me assume you are referring to Original estimates OR Story points OR versions etc. Now, you want to see all the calculated fields from the linked (sub tasks) in the original issue type- Story/ Bug. 

Am I correct with understanding your query?

Meanwhile, I would request to access this link which has detailed sub links for your reference: https://support.atlassian.com/jira-software-cloud/docs/work-on-and-progress-your-issues/

If that link resolves your query, then "accept my answer" for the benefit of new members.

  • Hi subramanyam,

87A5AF23-D64C-4180-B95E-918C34056B56.jpeg990B5E39-C522-4A3E-8994-5B30E4D81997.jpeg

for issue type the linked issues are not an sub task those are main issues only i have attached ss for refrence the link issues need to calculate automatically and display in parent issue progress

1 vote
Daniel Ebers Community Leader Feb 28, 2021

Hi @Madhu

this will require coding, there is no functionality available out of the box.
When you say the existing field is already a Calculated Field, I am wondering if you already use some kind of App?

Assuming you have ScriptRunner installed you could look into library if a script matches your requirement.
From the first look this seems to be suitable, however adjustments are already likely to be needed:
https://library.adaptavist.com/entity/calculate-the-sum-of-all-values-of-a-custom-field-in-linked-issues

In case of specific questions sometimes Community members help in adjusting smaller parts of scripts. You could also wait if there is more contribution in regards to a solution made for you but in general, I'd suggest you start and show how far you came.
This motivates users mostly to give detailed advice.

Regards,
Daniel

Hi Daniel,

I have implemented below code but it not working, please help me need any modifications required

 

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.Issue

 

// The issue type for which we want the scripted field to be displayed

final issueTypeName = "Task"

 

// The linked issues with that issue type will used

final linkedIssueType = "is contained in"

 

// The values of that custom field - of type number - we want to sum up

final customFieldName = "Progress(WBSGantt)"

 

if (issue.issueType.name != issueTypeName) {

    return null

}

 

def linkedIssues = ComponentAccessor.issueLinkManager.getOutwardLinks(issue.id).findAll { it.destinationObject.issueType.name == linkedIssueType }

if (!linkedIssues) {

    return null

}

 

def customField = ComponentAccessor.customFieldManager.getCustomFieldObjects(linkedIssues.first().destinationObject).findByName(customFieldName)

if (!customField) {

    log.debug "Custom field is not configured for that context"

    return null

}

//linkedIssues*.destinationObject.sum { Issue it -> it.getCustomFieldValue(customField) ?: 0 }

 

double progress = 0

 

def CountLink = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter).getAllIssues().size()

CountLink.toString()

 

 

progress = (linkedIssues*.destinationObject.sum { Issue it -> it.getCustomFieldValue(customField) ?: 0 } / CountLink) * 100

 

linkedIssues*.destinationObject.findByName(customFieldName).setFormValue(progress.round(2))

Hi Daniel,

 

the fields are number fields for number fields I am trying to write the script  for that we are using script fields. 

in scripting I have written that code. Please check and let me know .

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you