Can JIRA create a specified number of subtasks automatically when you create an (main) Issue in JIRA?
Could it be possible to create an Issue Type in JIRA which could automatically create 3 or 4 Subtasks for this “main” issue. Anyone who have had this requirement before? It will save the time it takes to create all 3 or 4 subtasks after, and best could also be to automatically assign them to the related assignee.
Thanks in advance for any ideas for how to solve this.
There is a built-in task for the script runner plugin already.
I use the following Groovy script as a post-function to create another issue, but it could easily be modified to create subtasks.
import com.atlassian.core.user.UserUtils
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.util.ImportUtils
import com.opensymphony.user.User
import com.opensymphony.workflow.WorkflowContext
import org.apache.log4j.Category
log = Category.getInstance("com.onresolve.jira.groovy.CreateDependentIssue")
// Configurable section
def projectName = "Project" // Name of project you want to create the issue in
// for other customizations change the code below
issueMgr = ComponentManager.getInstance().getIssueManager()
projectMgr = ComponentManager.getInstance().getProjectManager()
String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();
User currentUserObj = UserUtils.getUser(currentUser);
def wasIndexing = ImportUtils.indexIssues
ImportUtils.indexIssues = true
issueFactory = ComponentManager.getInstance().getIssueFactory()
newissue = issueFactory.getIssue()
newissue.setSummary (issue.summary)
newissue.setProject (projectMgr.getProjectByName(projectName))
newissue.setIssueType (issue.getIssueType())
newissue.description = "new issue description"
newissue.reporter = issue.getAssignee()
newissue.assignee = issue.getAssignee()
params = ["issue":newissue]
subTask = issueMgr.createIssue(currentUserObj, params)
println subTask.get("key")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do this in a JIRA Listener.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't have an example with me at this moment. Btw, Post function also will work. You can add it as a post function on the Create transition. So go ahead and use it if you got it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would really appreciate if you could send me an example of how this could be done.
I also saw an example with JSS script that creates a subtask in a post function.
Thanks,
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.