You have to do a search in your script with the JQL stated by Chris. You could use a method like this.
import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.user.ApplicationUsers import com.atlassian.jira.web.bean.PagerFilter static List<Issue> getFilterResult(String jqlSearch, ApplicationUser user) { SearchService searchService = ComponentAccessor.getComponent(SearchService.class) IssueManager issueManager = ComponentAccessor.getIssueManager() List<Issue> issues = null SearchService.ParseResult parseResult = searchService.parseQuery(ApplicationUsers.toDirectoryUser(user), jqlSearch) if (parseResult.isValid()) { def searchResult = searchService.search(ApplicationUsers.toDirectoryUser(user), parseResult.getQuery(), PagerFilter.getUnlimitedFilter()) // Transform issues from DocumentIssueImpl to the "pure" form IssueImpl (some methods don't work with DocumentIssueImps) // This is not needed in every place and the collect{} part maybe skipped for better performance issues = searchResult.issues.collect {issueManager.getIssueObject(it.id)} } return issues }
This method is completely without logging and only with basic error handling, so feel free to expand. :-)
Hi Henning.
Could you show me how to pick up the logged in user and also how to do JQL?
thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, you can get the current user like this
ApplicationUser user = ComponentAccessor.jiraAuthenticationContext.getUser()
And the jqlSearch String is the same you would enter as an advanced search in JIRA.
String jqlSearch = 'status = "In Progress" and assignee = currentUser()'
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.