Task issue

Madhu February 24, 2021

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

1 vote
Daniel Ebers
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 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

Madhu March 1, 2021

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))

Madhu March 1, 2021

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 .

1 vote
G subramanyam
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 24, 2021

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.

Madhu February 24, 2021
  • 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

Suggest an answer

Log in or Sign up to answer