I'm currently using the following scriptrunner code in my post creation transition validator, but it's throwing an error.
Code -
reporter = issue.reporter jql = "project = PE and resolution = Unresolved and reporter = currentUser()" jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) searchService = ComponentAccessor.getComponent(SearchService) query = jqlQueryParser.parseQuery(jql) count = searchService.searchCount(reporter, query) if (count >= 2) { throw new InvalidInputException("The limit of open tickets for the 'PE' project is reached for the current user") }
Error - ScriptRunner Script. The configuration is invalid.
The goal is to limit current users from not being able to open more than two tickets at a time.
Hi Austin,
I can confirm that inside of Jira Cloud Workflow Validators use the Jira Expression Framework provided by Atlassian.
You must use the Jira Expression Framework syntax to write your validator. We have many examples here that show how to write validator expressions to help you write the validator you require.
I hope this information helps.
Regards,
Kristian
Hi and Welcome to the Atlassian Community!
You can not use this code on Cloud. Services like ComponentAccessor, JqlQueryParser ... etc you can't access them in Cloud. You will have to rewrite your Server / Datacenter code to a Cloud compatible version using the Cloud REST API's.
Have a look at this resource from Adaptavist explaining this:
Jeroen
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.