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
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.
I need a script that will count all related issues with link name "has a defect" and priority in Blocker || Critical? and insert the counter number into the custom field.
So I wrote some script, it considers all related issues as Critical and Blocking priority, but I can't add check for inward link name "is defect of", can you please help me.
def countS = ComponentAccessor.getIssueLinkManager().getLinkCollection(issue, issue.reporter)
it.priority.name in ['Critical', 'Blocker']
// custom field id
final long MY_CUSTOM_FIELD_ID = 14320;
// get issue to update
MutableIssue issue = ComponentAccessor.getIssueManager().getIssueByKeyIgnoreCase(issue.key);
// custom field reference
CustomField myCustomField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(MY_CUSTOM_FIELD_ID);
// construct the new value
ModifiedValue newValue = new ModifiedValue(issue.getCustomFieldValue(myCustomField), countS);
// update the field to "new value"
myCustomField.updateValue(null, issue, newValue, new DefaultIssueChangeHolder());