Hi,
I'm trying to create few subtasks based on custom field values. For example if i select 2 users in user pick(multiple), two sub tasks to be created and assigned to that users selected along with main tasks(this is not yet implemented as of now). Im just creating a sub task with static values. Here is the steps followed
- Created custom plugin
public class MyCreatePostFunction extends AbstractJiraFunctionProvider {
public void execute(Map transientVars, Map args, PropertySet ps)
throws WorkflowException {
MutableIssue issue = getIssue(transientVars);
IssueInputParameters issueSubtaskParams = issueService.newIssueInputParameters();
issueSubtaskParams.setSummary("Testing...");
issueSubtaskParams.setProjectId(issue.getProjectObject().getId());
issueSubtaskParams.setIssueTypeId("5");
CreateValidationResult validationResult = issueService.validateSubTaskCreate(user,issue.getId(), issueSubtaskParams);
IssueService.IssueResult issueResult = issueService.create(user, validationResult);
}
}
2. Added this post function after "Creates the issue originally." here is the order
- Creates the issue originally.
- Successfully created subtasks (MyCreatePostFunction )
- Re-index an issue to keep indexes in sync with the database.
- Fire a Issue Created event that can be processed by the listeners.
When i try creating issue, the above code keeps create the subtasks in infinite loop. Please guide me how to avoid this issue.