You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello Community,
I´ve found an script to calculate the sum of Story Points in all linked Issues with a scripted field via ScriptRunner and adjusted it to my use case like this:
Now the requirement has changed, and I would like to have the sum of Story Points in all linked issues except the issueLinkType "is blocked by". In case that I´m not a developer and new to jira, I have no clue how to modify this script, to run it for my use case. I hope that someone has an idea. Thank you in advance for your support.
For your requirement, you should try something like this:-
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.issueLinkManager
def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def customFieldManager = ComponentAccessor.customFieldManager
def storyPoints = customFieldManager.getCustomFieldObjectsByName('Story Points').first()
issue.getCustomFieldValue(storyPoints) as Double
def linkCollection = issueLinkManager.getLinkCollection(issue, loggedInUser) // to get all the linked issues for the current issue
def excludedIssues = linkCollection.getInwardIssues('Blocks')
def totalStoryPoints = linkCollection.allIssues - excludedIssues // to filter out issues that are blocked
totalStoryPoints.collect {
it.getCustomFieldValue(storyPoints) as Double
}.sum()
Please note that the sample working code above is not 100% exact to your environment. Hence, you will need to make the required modifications.
Below is a screenshot of the Scripted Field's configuration:-
I also include a couple of test screenshots for your reference:-
The first issue is linked to 3 other issues. Two are using the relates to link, and one is using the is blocked by link. If you compare the first screenshot below with the other three screenshots, you will notice that in the issue MOCK-1, only the story points from MOCK-2 and MOCK-3 are calculated. However, the story points from MOCK-4 are excluded because it is a blocker.
I hope this helps to solve your question. :-)
Thank you and Kind regards,
Ram
Does the solution I provided answer your question?
If yes, could you please accept the solution?
Thank you and Kind regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ram Kumar Aravindakshan _Adaptavist_
first of all thank you very much for the detailed answer. I have to apologize, that I didn´t answered yet. I was very busy this week due to other subjects in my company. In case of that I couldn´t test ist yet. I will response and accept your solution until Monady evening.
I hope that this is okay for you.
Thank you and kind regards.
Shahin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ram Kumar Aravindakshan _Adaptavist_
thank you again for the effort. After some tries, I´ve figured out the right modification for our instance. Now it´s working pretty well.
best regards
Shahin
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.