how can i create a sub-task for each user in multi user picker?
Community moderators have prevented the ability to post new answers.
Here is the script I hacked together. This script is fired on the create issue workflow step. It creates a sub-task of type 41 for each user in the Technical response required from custom field. This is a multi-user picker. It also pulls the Technical response due by date field and sets the sub-task due date field.
import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.ComponentManager cfTech = ComponentManager.getInstance().getCustomFieldManager().getCustomFieldObjectByName("Technical response required from") cfDate = ComponentManager.getInstance().getCustomFieldManager().getCustomFieldObjectByName("Technical response due by") Collection<User> users= (Collection) issue.getCustomFieldValue(cfTech); if(users != null) { for(i in 0..users.size()-1) { Object AssigneeValue = users.get(i).getName(); issueObject = componentManager.getIssueFactory().getIssue() issueObject.setProject(issue.getProject()) issueObject.setIssueTypeId("41") issueObject.setParentId(issue.getId()) issueObject.setSummary(issue.getSummary()) issueObject.setSummary("Technical response required for quote") issueObject.setDueDate(issue.getCustomFieldValue(cfDate)) issueObject.setAssigneeId(AssigneeValue) issueObject.setReporter(issue.getReporter()) subTask = componentManager.getIssueManager().createIssue(componentManager.getJiraAuthenticationContext().getUser(), issueObject) componentManager.getSubTaskManager().createSubTaskIssueLink(issue.getGenericValue(), subTask, componentManager.getJiraAuthenticationContext().getUser()) i++ } }
Hi Justin,
After alot of research and searching I found your post and I would like to know how to implement an multi approval workflow using subtasks with one multiple user picker. Would it be possible for your to guide me in implementing this. Since when i tried to cut and paste it I have seen alot of errors. I am using JIRA 6.4.12 and Scriptrunner 4.1.3.24
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Depends under what circumstances you are thinking about. If you want to do this as part of a workflow transition, then Create on Transition Plugin for JIRA has support for that. See How to create multiple issues - advanced example
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am looking to create the sub-task(s) on a workflow transition. The plugin looks like a great option but I will not be able to license it at this time. I am trying to piece together groovy scripts that I've found. I am also looking for groovy documentation related to custom fields and multi user pickers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bob, is it possible to create subtasks for each group from group multipicker? Best regards, Rok
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.