Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get the linked issues with same title and different issue type

Sahish January 30, 2023

Hello All,

My question is, how to search/get all the linked issues with the same title and different issue type in one issue?

Thanks in advance,

Sahish

1 answer

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2023

Hi

Here is a short script you can try in the Scriptrunner console that will return the list of issues linked to issue ABC-1 where the Summary and Issue Types are the same.

import com.atlassian.jira.component.ComponentAccessor

def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issue = ComponentAccessor.issueManager.getIssueObject('ABC-1')

def links = ComponentAccessor.issueLinkManager.getLinkCollection(issue, currentUser)
if(!links){
log.warn "There are no issue links on $issue.key"
return null
}
def filteredLinkedIssues = links.allIssues.findAll{it.summary == issue.summary && it.issueType == issue.issueType}

if(!filteredLinkedIssues) {
log.warn "There are no issues linked to $issue.key where the Issue Type is $issue.issueType.name and Summary is '$issue.summary'"
return null
}
log.info "${filteredLinkedIssues*.key} are linked to $issue.key and have the same Summary and Issue Type"
return filteredLinkedIssues*.key
Sahish January 30, 2023

Hi @PD Sheehan ,

Thanks for the solution. It worked for me. But in my case both summary and issue type is different. In this case, may I know how to approach this?

Thanks in advance,

Sahish

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 30, 2023

Then I don't think I understand your case.

Your question was:

 how to search/get all the linked issues with the same title and type in one issue

Can you expand on what you are trying to do that is not searching amongst linked issues for an issue with the same title and type?

Sahish January 30, 2023

Hi @PD Sheehan ,

My requirement is like - I have an issue type Release, when one custom field updates in Release workflow, automatically one issue will create, this ticket issue type is "Add Project" so basically both are different types of issue types.

Thanks,

Sahish

PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 31, 2023

So then what's your question?

I showed you how you can access all issues linked to the current/known issue.

From there, you can filter or not on any aspect of an issue.

Suggest an answer

Log in or Sign up to answer