Good morning,
I'm trying to prevent an issue to be open if the same account created an issue with the same request type less than 2 months ago.
I was thinking to use a Script Runner Validators, i'm searching any code about it with no success.
Currently i can't find any alternative or workaround.
Does anybody smarter than me helps me?
Thanks,
Luca
It is not 100% clear but as far as I understand your JQL should be like
String projectName = issue.getProjectObject().getName()
String summary = issue.getSummary()
String queryJql = """project = "$projectName" AND summary ~ "$summary" AND reporter = currentUser() AND updatedDate >= startOfDay(-60d)"""
I hope this sheds some light.
Hello,
This is a part of the script
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.opensymphony.workflow.InvalidInputException;def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchService = ComponentAccessor.getComponent(SearchService)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()// Query per fare la ricerca JQL
String queryJql = 'summary ~ "Terminale*" AND reporter = currentUser() AND updatedDate >= startofDay(-60d)'def query = jqlQueryParser.parseQuery(queryJql)
def search = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
if(search.results.size() >= 1)
throw new InvalidInputException("E' stata aperta una richiesta meno di 60 giorni fa.")
It throws an exception when i try to create another ticket within the same project (the project is called "Terminale" too), instead i need it to throw an exception when i try to create a ticket with the same "Request name".
Any suggest?
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.