[转]Dynamic Forms
作者:互联网
本文转自:https://scriptrunner.adaptavist.com/6.5.0/jira/dynamic-forms.html
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.search.SearchProvider import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.user.ApplicationUser import com.atlassian.jira.web.bean.PagerFilter import com.onresolve.scriptrunner.parameters.annotation.UserPicker @UserPicker(label = "Assignee", description = "Issues with this assignee will be permanently deleted") ApplicationUser user // issues returned from that JQL will get deleted final String searchQuery = "assignee = $user.name" def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchProvider = ComponentAccessor.getComponent(SearchProvider) def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def issueService = ComponentAccessor.issueService def query = jqlQueryParser.parseQuery(searchQuery) def searchResults = searchProvider.search(query, loggedInUser, PagerFilter.unlimitedFilter) searchResults.getIssues().each { issue -> def deleteValidationResult = issueService.validateDelete(loggedInUser, issue.id) assert deleteValidationResult.isValid() : deleteValidationResult.errorCollection def deleteResult = issueService.delete(loggedInUser, deleteValidationResult) assert deleteResult }
标签:jira,ComponentAccessor,Dynamic,atlassian,Forms,import,com,def 来源: https://www.cnblogs.com/freeliver54/p/15881123.html