Issue
I am trying to move and assign multiple issues from Jira using Jenkins
ticketID= jiraIssueSelector(issueSelector: [$class: 'JqlIssueSelector', jql: 'some JQL queries'])
step([$class: 'JiraIssueUpdateBuilder', jqlSearch: "someJQLqueries", workflowActionName: 'Done'])
jiraAssignIssue idOrKey: ticketID, userName: null, failOnError: false
The first step where I am changing the workflow is working fine. However, I can not change the assignee I am getting the bellow message. Is there a way to use the Jira plugin instead of the Jira plugin step to update a non-custom field?
java.lang.ClassCastException: org.thoughtslive.jenkins.plugins.jira.steps.AssignIssueStep.idOrKey expects class java.lang.String but received class java.util.HashSet
I also tried the following and it is not working:
step([$class: 'IssueFieldUpdateStep', fieldId: 'assignee', fieldValue: 'someUser', issueSelector: [$class: 'JqlIssueSelector', jql: 'some JQL query']])
Solution
I found the answer to loop through all the tickets in the jql:
ticketID= jiraIssueSelector(issueSelector: [$class: 'JqlIssueSelector', jql: 'some JQL queries'])
ticketID.each{ ticket ->
jiraAssignIssue idOrKey: ticket, userName: null, failOnError: false
}
Answered By - TestingCodes