Hello,
I have created a user story. Then I have created 2 tasks from this user story. I have specified estimated time for each tasks. My question is : Why the estimated time for my user story still blank? When I check the backlog view, the addition is not made!
You can achieve this by create a scripted field & add that script field on your parent story.
Inline Code:
(This code is for linked issues. It can be modified for sub-task)
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Category
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.setLevel(org.apache.log4j.Level.DEBUG)
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def totaloriginalEstimatedWork = 0
issueLinkManager.getOutwardLinks(issue.getId()).each() {l->
// log.debug(l.issueLinkType?.getName())
def linkedIssue = l.destinationObject
totaloriginalEstimatedWork += linkedIssue.originalEstimate ?: 0
}
def timeoriginalEstimatedWork = ""
if(totaloriginalEstimatedWork) {
def hours = totaloriginalEstimatedWork / 3600;
def minutes = (totaloriginalEstimatedWork % 3600) / 60;
def seconds = totaloriginalEstimatedWork % 60;
timeoriginalEstimatedWork = hours
}
return timeoriginalEstimatedWork
By using script field. I used this code for linked issues. You can modify as per your requirement(subtask).
import com.atlassian.jira.issue.Issue
import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Category
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.component.ComponentAccessor
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.setLevel(org.apache.log4j.Level.DEBUG)
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def totaloriginalEstimatedWork = 0
issueLinkManager.getOutwardLinks(issue.getId()).each() {l->
// log.debug(l.issueLinkType?.getName())
def linkedIssue = l.destinationObject
totaloriginalEstimatedWork += linkedIssue.originalEstimate ?: 0
}
def timeoriginalEstimatedWork = ""
if(totaloriginalEstimatedWork) {
def hours = totaloriginalEstimatedWork / 3600;
def minutes = (totaloriginalEstimatedWork % 3600) / 60;
def seconds = totaloriginalEstimatedWork % 60;
timeoriginalEstimatedWork = hours
// log.debug(timeoriginalEstimatedWork)
}
return timeoriginalEstimatedWork
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks we will test!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.