Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create 50 subtasks using script runner add-on

RNV Jira1 September 25, 2022

Hi All,

I am looking for some help to create 50 subtasks when a issue with issuetype story or task is created in a project using the script runner addon

while the subtasks are created, each subtask should have different assignee, summary and description values based on the information we get from the users, can anyone help me with the script which i can use in script runner add on which can create 50 subtasks in one step and have its own field values

Thanks in advance 

 

3 answers

2 accepted

1 vote
Answer accepted
Dirk Ronsmans
Community Champion
September 25, 2022

Hey @RNV Jira1 ,

What @Hana Kučerová says is indeed the easiest solution. Only drawback there is you'll have to create 50 postfunctions (1 for each task)

If you want to script it as a single script (like a loop) you can look at the Adaptavist library script to get you started.

https://library.adaptavist.com/entity/create-a-sub-task-and-link-to-parent-issue-in-jira

If you take the logic from this script but loop it you can use it for as many as you want!

Nana Kankam March 3, 2023

That library link is no help. "Issues.createSubTask" doesn't exist

0 votes
Answer accepted
Hana Kučerová
Community Champion
September 25, 2022

Hi @RNV Jira1 ,

there is the post-function called “Create a sub-task” available. I recommend you to use it, I believe it will be much easier. See the documentation:

https://scriptrunner.adaptavist.com/latest/jira/builtin-scripts.html#_create_a_sub_task

0 votes
RNV Jira1 September 29, 2022

Thank you  @Hana Kučerová & @Dirk Ronsmans your inputs have helped working on the script. Can you please also provide some guidance with setting  value for a custom field which is of the type as "label"

I tried this 

"def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'labels1'}
issue.setCustomFieldValue(cf, 'my value') "

 

but it did not work for the custom field which was of label type, rest of the custom fields were getting updated. So can you please help with the script which might work for updating the label custom field

Thanks

Dirk Ronsmans
Community Champion
September 29, 2022

I don't have experience with that personally but you can look here

https://library.adaptavist.com/entity/update-the-labels-for-an-issue-in-jira

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, likes for trees, atlassian community, social impact, tree planting campaign, community kudos, atlassian giving, environmental impact, sustainability, likes for good, atlassian social responsibility, community challenge

Make every click count—help us plant 50,000 trees! 🌳

Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!

Help us plant more trees
AUG Leaders

Atlassian Community Events