Forums

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

Need to bulk update sub-tasks using Scriptrunner

Kaushik Patel April 6, 2020

I want to bulk update one field of multiple sub-tasks.

This field is issue summary field or it is called task title.

I tried using JIRA bulk update feature but I didn't find the issue summary field to bulk update.

I have ScriptRunner installed. Can this be accomplished by ScriptRunner?

If so, I would need help with query.

e.g. I want to set issue summary field for multiple sub-tasks to "Test sub-tasks".

I have list of sub-tasks for which I need to make the bulk update.

Thanks,

Kaushik.

1 answer

1 accepted

1 vote
Answer accepted
Leo
Community Champion
April 6, 2020

Hi @Kaushik Patel,

Below is the sample script which I run in script console to update issue's summary

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.event.type.EventDispatchOption;

def issue = ComponentAccessor.issueManager.getIssueByCurrentKey("PARENT-23")
def subtasks = issue.getSubTaskObjects()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
subtasks.each{ subtask ->
def sb = subtask as MutableIssue
sb.setSummary("Summary from console")
ComponentAccessor.getIssueManager().updateIssue(user,sb,EventDispatchOption.ISSUE_UPDATED, true)
}

 hope this gives you some idea

 

BR,

Leo

Kaushik Patel April 12, 2020

Thank you Leo. This solution worked.

Appreciate the timely help.

Suggest an answer

Log in or Sign up to answer