Creating subtasks with jmwe groovy script

salini_s October 30, 2019

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.

1 answer

2 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2019

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}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events