I want to create multiple subtasks which is equal to the number of components in the project using groovy script in jmwe while creating an issue.Could someone please help with the code.
Why would you like to do this with Groovy scripting (I assume you mean a Scripted (Groovy) post-function? You can achieve this with the Create/Clone Issue(s) post-function, using the "multiple issue creation" option.
For the iterator script, use:
issue.get("components")
Then, in the rest of the configuration, you'll be able to refer to the "current" component (since the post-function will be iterating over the components and will be creating one issue for each) as:
it
For example, you could copy the current component to the Component/s field of the sub-task by adding the Component/s field in the "Set fields of new issue" section and setting it to "Set value to Groovy Expression" with this expression:
it
or you could append the component name to the sub-task Summary like this:
New sub-task for component ${it.name}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.