try with this code(i have used in java), do changes as per your requirement
Issue issue = (Issue) transientVars.get("issue"); for(int i=1;i<=5;i++){ createSubtask(issue); } public void createSubtask(Issue sIssue) { MutableIssue mutableIssue =ComponentAccessor.getIssueFactory().getIssue(); mutableIssue.setDescription("Test"); IssueType issueType = IssueCustomFieldConstants.constantsManager.getIssueTypeObject(3);//enter subtask issue type id as int mutableIssue.setIssueTypeObject(issueType); mutableIssue.setPriorityId(3); mutableIssue.setSummary("summary"); mutableIssue.setProjectObject(sIssue.getProjectObject()); mutableIssue.setReporter(sIssue.getReporter()); mutableIssue.setAssignee(sIssue.getReporter()); Map<String, Object> params = new HashMap<String, Object>(); params.put("issue", mutableIssue); final JiraAuthenticationContext authenticationContext = ComponentAccessor.getJiraAuthenticationContext(); User currentUser = authenticationContext.getLoggedInUser(); try { IssueManager issueManager = ComponentAccessor.getIssueManager(); Issue issue = issueManager.createIssueObject(currentUser, params); SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager(); boolean isSubtaskEnabled = subTaskManager.isSubTasksEnabled(); subTaskManager.enableSubTasks(); subTaskManager.createSubTaskIssueLink(sourceIssue, issue, currentUser); if (!isSubtaskEnabled) { subTaskManager.disableSubTasks(); } } catch (CreateException e) { e.printStackTrace(); } }
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.