On Create: Validator to confirm if Summary is a duplicate

Megan D March 28, 2024


I want to create a validator script when a reporter tries to create a new issue. It should query the Project and validate that the Summary is unique.

-If it IS unique, then the transition is allowed.

-if it IS NOT unique, add a warning to the Summary field that they need to locate that particular Issue instead.

Can anyone help me with this? I've tried this with no luck, but it's probably very wrong:

def summaryResult= sourceIssue.summary +"New Request"

if (issue.getSummary()== summaryResult){
return false


1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 9, 2024

Hi @Megan D ,

try something like this :


import com.atlassian.jira.issue.MutableIssue

import com.atlassian.jira.user.ApplicationUser

import com.atlassian.jira.component.ComponentAccessor;

import com.atlassian.jira.issue.Issue;

import com.atlassian.jira.bc.issue.search.SearchService;

import com.atlassian.jira.issue.search.SearchResults;

import com.atlassian.query.Query;

import com.atlassian.jira.web.bean.PagerFilter;

import java.util.Iterator;


SearchService searchService = ComponentAccessor.getComponent(SearchService.class);

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

def summaryResult= sourceIssue.summary +"New Request"


String jqlQuery = "project = "+sourceIssue.getProjectObject().getKey()+" and summary ~ "+summaryResult;

SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlQuery);

Query query = parseResult.getQuery();

SearchResults<Issue> results = searchService.search(user, query, PagerFilter.getUnlimitedFilter());

List<Issue> issuesDoc = results.getResults();


return false;


return true;
Hope this helps,

Suggest an answer

Log in or Sign up to answer