There is a case where my group needs to create multiple sub-tasks (for separate tasks under the same project), or delete multiple related sub-tasks. I know you can create issues using HTML links (https://confluence.atlassian.com/display/JIRA/Creating+Issues+via+direct+HTML+links); however, it still brings you to a page to create the issue, and it doesn't appear to allow the creation/deletion of multiple issues. These issues would have the same exact information in them, it is just required to create identical sub-tasks for separate tasks. For deletion, once one of the subtasks are deleted, the related sub-tasks (on the other tasks) would be deleted as well.
Is there a way to automate the creation of tickets like this? I can create the script, but I don't know how to contact Jira to create/delete the issues. I would prefer to do this without any additional plugins/add-ons.
Thanks for any help!
Community moderators have prevented the ability to post new answers.
I was able to figure it out without plugins. I am using the SOAP API to make requests to and from the Jira server. I use this basic format to set up the connection in PowerShell:
$jirasvc = New-WebServiceProxy -Uri "http://jiraserver/rpc/soap/jirasoapservice-v2?wsdl" $username = "username" $password = "password" $token = $jirasvc.login($username,$password)
Then from there, you can create an object to hold all subtask information:
$namespace = $jirasvc.GetType().Namespace $issue = New-Object "$namespace.RemoteIssue" $issue.summary = $summary $issue.description = $description $issue.assignee = $assignee $issue.type = "5" # subtask $issue.priority = "4" #Minor $issue.project = "ProjKey"
The variables ($summary, $description, $assignee) contain information related to the specific subtask the user is creating. This is manually entered by the user.
After the subtask is created, I loop through an array containing all task keys in a specific project. You can get all of these using a JQL query (and select statement in PowerShell):
$pkeyarray = $jirasvc.getIssuesFromJqlSearch($token, 'project="ProjKey" AND status="open" summary~"Requests"',"10000")
This is assuming all tasks have similar names (ex: All of the relavant tasks in this project have "Requests" at the end of them). The following loop (in PowerShell) will create the subtasks on the list of tasks in the array that was just generated:
foreach($pkey in $pkeyarray) { $jirasvc.createIssueWithParent($token,$issue,$pkey) }
I haven't gotten to scripting a "mass resolve" (which would do the opposite of what this script does), but you would use this to resolve an issue:
$issue = New-Object "$namespace.RemoteFieldValue" $issue.id = "resolved" $issue.values = "5" $jirasvc.progressWorkflowAction($token,"ST-100","5",$issue)
The following statement would resolve a subtask with the key "ST-100". Obviously to do the opposite of the addition that I did above, you would need to create a loop that loops through the appropriate subtask keys to resolve them.
Hopefully this will help someone else!
Ah, I didn't realise you were working outside Jira. Remote automation is a totally different story.
Good solution, with a minor caveat - SOAP is now "legacy" and remote stuff should be done with REST (I don't think Atlassian will remove SOAP anytime soon, but they are very clear that they won't extend it, as they will with REST)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, that's why people have written plugins to automate this sort of thing. You've also got some very specific requirements here which probably rule out the more generic plugins.
I'd reach for the script runner plugin - I think it can do all of what you've listed: https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner
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.