I've been working on this issue where Jira should give an error during ticket creation if the same summary exists in the Jira project.
I tried the below code where I get the list of summaries and the current summary. here I also want to compare the same.
It would be great if anyone is up here to help me in this regard.
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
def groupManager = ComponentAccessor.getGroupManager()
// Get the issue manager
IssueManager issueManager = ComponentAccessor.getIssueManager()
// Get the summary of the issue being created
def summary = issue.getSummary()
def searchService = ComponentAccessor.getComponentOfType(SearchService)
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def filter = "Project = TDT"
SearchService.ParseResult parseResult = searchService.parseQuery(user, filter)
def results = searchService.search(user, parseResult.query, PagerFilter.unlimitedFilter)
//def issues = results.issues //Jira 7
def issues = results.results //Jira 8
issues.each { it ->
log.debug(it.summary)
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.