Im doing a condition to be ....
Issue was previously in status 'Review'
This is basically so i can set a resolution depending on what route the user went around the workflow.
Thanks
Here is an example of running JQL in a script:
import com.atlassian.jira.bc.issue.search.SearchServiceimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.IssueManagerimport com.atlassian.jira.issue.MutableIssueimport com.atlassian.jira.issue.search.SearchResultsimport com.atlassian.jira.user.util.UserUtilimport com.atlassian.jira.user.ApplicationUserimport com.atlassian.jira.web.bean.PagerFilterString jqlSearch = "status changed from \"Status 1\" to \"Status 2\""SearchService searchService = ComponentAccessor.getComponent(SearchService.class)UserUtil userUtil = ComponentAccessor.getUserUtil()ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()IssueManager issueManager = ComponentAccessor.getIssueManager()List<MutableIssue> issues = nullSearchService.ParseResult parseResult = searchService.parseQuery(user, jqlSearch)if (parseResult.isValid()) {SearchResults searchResult = searchService.search(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())issues = searchResult.getResults().collect {issueManager.getIssueObject(it.id)}} else {log.error("Invalid JQL: " + jqlSearch);}
You can use status was "Some Status"
Hi Payne, sorry im confused what you mean?
Im looking for a script just like the JQL
status changed FROM "Status 1" TO "Status 2"
Sorry, I thought you were seeking the JQL. I'm attaching a script as a new answer.
Hi Payne, thanks so much for you help.
Im getting the below error when i put this into my condition....
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.search.SearchResults.getResults() is applicable for argument types: () values: [] Possible solutions: getIssues()
You must be running an older version of Jira than we are (8.5); getIssues() was replaced with getResults() somewhere along the way. My script is an updated version of one that I found at https://community.atlassian.com/t5/Marketplace-Apps-Integrations/How-to-run-JQL-query-inside-Groovy-script/qaq-p/194691 Try that one and see if it works for you.
Excellent! Thanks again for your help
It looks like you're new here. Sign in or register to get started.