Hello Team,
I am having a requirement like,
I want to calculate the value between the Parent Issue and subtask,
Example :
If there is Issue STORY.
In that we are having a field like STORYPOINTS
In STORYPOINTS i have given a value example-3
and the subtask I have give some value for STORYPOINT Example-2
And the same thing in the other subtask of the same parent issue.
Now I want to calculate the values of different Story points and I want to display them in the parent issue(STORY).
Please suggest the right way to proceed further to resolve this topic.
Thank you.
Regards.
Varun Joseph Allu.
Hi Varun,
I created this script for a script field of type Number:
import com.atlassian.jira.component.ComponentAccessor
if (issue.getIssueType().name == "Story") {
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def storyPointsField = customFieldManager.getCustomFieldObjectByName("Story Points")
def pointSum = 0
pointSum += issue.getCustomFieldValue(storyPointsField)?:0
issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
def linkedIssue = issueLink.getDestinationObject()
if (linkedIssue.getIssueType().name == "Sub-task") {
pointSum += linkedIssue.getCustomFieldValue(storyPointsField)?:0
}
}
return pointSum
}
Let me know if it works.
Joshua
Thanks a lot Joshua,
I will test it :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sorry commented with another id
Thanks a lot Joshua,
I will test it :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can now do this using Jira's built-in automation: https://www.atlassian.com/fr/software/jira/automation-template-library/sum-up-story-points 🎉
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Joshua,
Thanks a lot for your help,
I have implemented the scripting field.
I found one error with that,
If we have given Story Points 2 in the parent issue,
And in subtask story points 3
The total 5 should be displayed in the parent issue..
But the story point(2) I have given in the parent issue is copied to the subtask and it is displaying total story points as 4 instead of 5,
When we manually edit the subtask story point it is showing the accurate calculation ...
Please help me in this error.
Thanks a lot in advance.
Regards,
Varun.
Varun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mr.Joshua.
Thanks for the script it is working fine.
I am having a question,
What are the changes that I have to do in the script to make that available for all issue types,
Now the script is only for Story issue type, I want to modify it for all other issue types in the project.
So that, it will calculate all subtasks story points in the Jira project.
Thank & regards,
Varun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varun,
If you remove the first 'if' statement that checks to see if the issue type is a story, this script should work for all the other issue types. Like this:
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def storyPointsField = customFieldManager.getCustomFieldObjectByName("Story Points")
def pointSum = 0
pointSum += issue.getCustomFieldValue(storyPointsField)?:0
issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
def linkedIssue = issueLink.getDestinationObject()
if (linkedIssue.getIssueType().name == "Sub-task") {
pointSum += linkedIssue.getCustomFieldValue(storyPointsField)?:0
}
}
return pointSum
Now every issue in your project will display this script field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mr. Joshua Ray Yamdog ,
should we place this scripted field on project screens if we want to see it on particular projects or it will display globally ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And last time when I created a scripted field for sprint start date and end date, the reindex took very long time and Atlassian said that because of the scripted field it is taking time and failing Any thoughts ?
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.