Dynamically create subtasks based on select list field

Matthew Ford November 1, 2019

I have a custom field single check list and if a value is selected, I need to create a subtask based on the value.  The subtask needs to have the summary based on the value in the field and the assignee should be based on the value and an email should be sent to a distribution list (not a user) associated to the selection in the field.

Additionally, if the value Global is selected from the custom field mentioned above, then ALL entries from the select list should be used to create subtasks per process above.

The Global option should not have a subtask, so that selection is ignored in regard to creating a subtask, it is used to denote to JIRA that all the other entries in the select list should be used to create a subtask

JIRA needs to read the selected value and if it is Global, it will then needs to get a list of ALL values that are possible in the select list and then create a subtask for each value in the single select list.  Again, it would not create a subtask for Global, just all the other possible values.

2 answers

0 votes
Leonard Chew
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 14, 2019

Hi Matthew 

Yes, with Scriptrunner it needs some scripting.

I'd do it like this:

  1. Create a custom Listener "on update" event (groovy script)
  2. The listener checks the the newly saved value of the dropdown
  3. based on the value it creates the subtasks.

I dont have the code at hand, but here are some hints:

get the dropdown value
https://community.atlassian.com/t5/Jira-questions/ScriptRunner-Behaviour-Get-string-value-of-customfield-dropdown/qaq-p/908539

create sub-task
https://community.atlassian.com/t5/Jira-questions/Scriptrunner-Create-Subtask-for-a-task-which-is-created-by-quot/qaq-p/885501

-> the last comment by Elifcan Cakmak seems to be the best for you.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2019

Hi Matthew,

You will need an add-on for that from the Marketplace Apps. Either Automation for Jira or ScriptRunner should do that nicely. 

Matthew Ford November 1, 2019

I have scriptrunner, but do not see an option for this.  I think it would require groovy scripting?? 

Scriptrunner can create a subtask, but it is predefined.

Matthew Ford November 1, 2019

I installed Automation plugin and it does not have this feature.  For creating a subtask, it wants the Summary details hardcoded.  I need the summary details to be dynamic based on the value selected from the LOB single select field or ALL possible values if Global is selected in the LOB field (but excluding Global).

I am simply not familiar with writing groovy and would request help from the community. 

1. Need to read the value of LOB single select field

2. If value is anything other than Global, create a subtask for that value

3. If the value is Global, then create a subtask for ALL possible values currently in the LOB single select drop down.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 14, 2019

Hey Matthew - I would try contacting Automation for Jira or ScriptRunner support directly to see if they can help or if the functionality even exists.  Sorry to not be more help. 

Suggest an answer

Log in or Sign up to answer