Forums

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

Progress Based on Business Value in BigPicture

Ansar Rezaei
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.
July 2, 2020

Hi

I have a project plan like this picture. I'm going to calculate progress based on the custom  Business Value field. Business Value enters for the epic issue type in my plan on different levels, and I create this hierarchy based on the ParentChild issue link type.

I create 3 number custom field Type:

1- EBV(Estimated Business Value)(Likewise Original Estimate)

2- BBV(Burned Business Value)(Likewise Time Spent)

3- RBV(Remaining Business Value)(Likewise Remaining Estimate)

Progress Calculation for epics equal to 0 or 100 (Definition of Done), and I'll fill RBV the same as EBV when creating an issue(IP-5 issue in the screenshot) and consider 0 for BBV default value. When epic transfer to done status, I transfer EBV value to BBV and change it's value to 0 (IP-6 issue in the screenshot).

image.png

What I want is a scripted progress field to calculate BBV/EBV for the IP-2 issue which it means: (15+5+5)/(15+5+5+5)=0.83

I write this script thanks to Adaptivist Library,  But it just looks for one level of ParentChild relation between issues.  I get 10 for EBV and 5 for BBV, which means it didn't get IP-7 and IP-8 values for this calculation.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

// the linked issues with that issue type will used
final String linkedIssueType = "Epic"

final String issueLinkTypeName = "ParentChild"


// the values of that custom field - of type number - we want to sum up
final String BurnedValue = "BBV"
final String EstimatedValue = "EBV"

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

def mycustomField = ComponentAccessor.customFieldManager.getCustomFieldObjects(linkedIssues.first().destinationObject).findByName(BurnedValue)
def myBurnedValue = ComponentAccessor.customFieldManager.getCustomFieldObjects(linkedIssues.first().destinationObject).findByName(BurnedValue)
def myEstimatedValue = ComponentAccessor.customFieldManager.getCustomFieldObjects(linkedIssues.first().destinationObject).findByName(EstimatedValue)

if (!myBurnedValue || !myEstimatedValue) {
log.debug "Custom fields are not configured for that context"
return null
}

def bbv = linkedIssues*.destinationObject.sum { Issue it -> it.getCustomFieldValue(myBurnedValue) ?: 0 }
def ebv = linkedIssues*.destinationObject.sum { Issue it -> it.getCustomFieldValue(myEstimatedValue) ?: 0 }


Any help in these scenarios will be appreciated:

1- Calculate this number fields based on the values of their children by ParentChild link

2- New scripted field that gets all these numbers at all levels and calculates progress based on them.

 

I know Bigpicture has some similar features that I want. Still, Unfortunately, It considers the values of this filed at last level of hierarchies, and If I break down epics to stories and subtasks, I have to enter 0 for these fields in all those issues that are very time-consuming. I think it's not a conventional method.

image.png

2 answers

1 accepted

0 votes
Answer accepted
Ansar Rezaei
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.
July 6, 2020

I handle this scenario with followings:

1- Create JMCF Calculated (scripted) Text/Html Field for progress calculation using this formula. This filed context sets for all issues that used as parent Issue at any level in hierarchy :

((issue.get("BBV")/issue.get("EBV")*100).round()) + "%"

2- Set a post function in Epic workflow Done transition to change the value of EBV and BBV together determine the value of this epic has been reached(burned) now.

3- Call JMWE Transition Related Issues Post-function after 2 in epic workflow

4- Create virtual calculation transition on each step of parent workflow and use JWT Read fields from linked issues or subtasks post function to collect and sum values of EBV, BBV, RBV fields of child issues, and put them on parent issue. This transition the same one that I mentioned in 3

5- Repeat step 3 for parent workflow.

 

I still need to write a listener to catch issue update event and recalculate progress and fields at all levels. Now I handle it with another virtual function on Epic workflow with a screen for editing BV filed, and in this transition, I repeat step 3 to call parent's calculation transition

image.png

  

0 votes
Ravi Sagar _Sparxsys_
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.
July 3, 2020

Hi @Ansar Rezaei 

Your approach is in the right direction. You need to write a listener to look for the update event and run your scripts. To traverse through the hierarchy you will need a create a recursive function that will follow the links, that is a straight forward approach but can cause performance issues if there are too many issues to update at different levels. 

Ravi

Ansar Rezaei
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.
July 3, 2020

Thanks for your reply @Ravi Sagar _Sparxsys_ 

I'm new to script runner. Could you give me some advice on rewriting my script?

 

I'm also evaluating Jira Workflow Toolbox, and it had a post function that exactly covers this scenario. Still, I have to create a virtual transition on each status that back to the same destination to get this capability without changing issue status, But I know it's not a regular one.image.png

This picture shows the jwt post function, which does the calculation:

image.png

 

, and call this listener in script runner in the Issue Update event.

Is this what you mention?

Anyway, I prefer to handle all of it in ScriptRunner. 

Suggest an answer

Log in or Sign up to answer