Currently i have got several examples of writing a scripted field to retrieve the linked issue data. i want to add a condition where script should validate 1) linktype and linked issue type.
ex: Ticket A has link to Ticket B (Task), C (Task) & D (Bug), ticket has link relates with B, D and blocks with C.
Now i am expecting my scripted field relates to retrieve 1, As it has bug as link issuetype.
currently i am using
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueLinks = issueLinkManager.getInwardLinks(issue.getId())
def subElements = issueLinks.findAll { issueLinks*.issueLinkType.name.contains('Relates')}
return subElements.size() as Double
Community moderators have prevented the ability to post new answers.
issueLinkManager.getInwardLinks(issue.id).each {issueLink -> linkedIssue = issueLink.destinationObject String issueType = linkedIssue.issueTypeObject.name if (issueType == "Bug"){ //to do } }
cuurently i am using this code import com.atlassian.jira.component.ComponentAccessor def issueLinkManager = ComponentAccessor.getIssueLinkManager() def issueLinks = issueLinkManager.getInwardLinks(issue.getId()) def subElements = issueLinks.findAll { issueLinks*.issueLinkType.name.contains('Relates')} return subElements.size() as Double This gives me data relating to number of links, but requirement is verify the linked issue type also
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Look at the destinationObject of each link and check the issuetype.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Relates" means, it is link based on the type of link. i have 10 tasks and 10 bugs linked to 1 story point all are using same relation. using above script i will get 20 as linked issues. i want 10 as answer. i want to count only linked bugs not tasks or vise verse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
that's what this code does: issueLinks.findAll { issueLinks*.issueLinkType.name.contains('Relates')}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the question? You want to write a condition, but you posted code for a script field...? Confused.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.