Description
Often you need to run the same action against a set of issues. This describes how to do that using runFromIssueList.
runFromIssueList is like other run actions and how it behaves. It will run the same action for each issue in a issue list determined by a filter or search (JQL). The issue list generated is similar to how getIssueList works. This works by providing a substitution variable that provides the issue key to the common action to run.
Substitution variables
Example 1
--action runFromIssueList --search "project = 'zjiracli' and labels != null" --common "--action addLabels --issue @issue@ --labels done-by-action"
Notes
- search is a JQL search, a filter could also be used
- common is the action that is run for each issue found by the search
Example 2
Creating a csv file with the results of action results run across multiple issues.
- Delete or clear the output file before starting
- Use --append on each request to append the data to an existing file
- Depending on the list you are constructing, you may need to use an outputFormat that contains issue field so the resulting file is more useful.
- Use release 3.6 or higher.
--action runFromIssueList --project zjiracliwork --common "--action getWorkList --issue @issue@ --file work.csv --append --outputFormat 2 --dateFormat yyyy-MM-dd"
"Issue","Id","Start","Time spent","Time spent (seconds)","Author","Update author","Created","Updated","Comment","Visibility" "ZWORK-1","22574","2013-07-29","3 hours, 30 minutes","12600","automation","automation","2013-07-29","2013-07-29","My work log entry","Developers" "ZWORK-1","22576","2011-01-02","1 day, 1 hour","90000","automation","automation","2013-07-29","2013-07-29","","" "ZWORK-1","22577","2011-01-01","3 hours, 30 minutes","12600","automation","automation","2013-07-29","2013-07-29","","jira-users" "ZWORK-2","22578","2013-07-29","3 hours, 30 minutes","12600","automation","automation","2013-07-29","2013-07-29","My work log entry","Developers" "ZWORK-2","22580","2011-01-02","1 day, 1 hour","90000","automation","automation","2013-07-29","2013-07-29","","" "ZWORK-2","22581","2011-01-01","3 hours, 30 minutes","12600","automation","automation","2013-07-29","2013-07-29","","jira-users"
Using runFromIssueList for deleteIssue
This is a special case that needs a slightly different approach in most cases. Delete errors can occur if you have subtasks in your project since when an issue gets deleted, it deletes its subtasks, but the subtasks may still be in the list to process. They will generate not found errors when they get processed. So, for delete processing, use JQL that includes issuetype in standardIssueTypes(). If trying to delete all issues in a project, don't use the shortcut way of just using --project, but use JQL instead.