Is it possible through scripting somehow to have an issue automatically created and added to a sprint when the user has started the sprint, through scripting? Thanks for any feedback you guys can offer!
Ok. Here is how we managed to do that:
1. Create a script listener and set the triggering event for a 'sprint start'
2. In the Script Context console write the following:
NOTE - Replace the following strings to your own ones:
'your-project-key' - to your project key name
'IssueType' - to the issue type you are trying to add (i.e Bug, Feature, Task etc.)
summary and description - write whatever you want. In our case we added the sprint name to the issue name thus you see the @$sprintName
Hope This helps
def projectKey = 'your-project-key'
def projectId = get("/rest/api/2/project/${projectKey}").asObject(Map).body.id
def taskType = get("/rest/api/2/issuetype/project?projectId=${projectId}").asObject(List).body.find { it['name'] == 'IssueType' }['id']
def sprintName = sprint.name
post("/rest/api/2/issue")
.header("Content-Type", "application/json")
.body(
[
fields: [
summary : "$sprintName - task-name",
description: "Commit all the subtasks which are done in $sprintName (Bug fixes and New Features) to Staging",
project : [
id: projectId
],
issuetype : [
id: taskType
]
]
])
.asString()
Wow, I have the same problem and can't figure out how to code this. I am reading all the ScriptRunner tuts and still am confused. Will let you know if I manage to do that
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.