You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Bulk Update the Value of a Custom Field on Jira Issues


Use this script in the Script Console to update the value of a custom text field for all issues returned by a query.


I have a project with many issues. I need to change the custom field value for all the issues in this project. With this script, I can easily bulk change all of these issues automatically.

Good to Know

  • (Cloud) Run as an admin user or as "ScriptRunner Add-On User" to make sure permissions to update are granted.


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.ModifiedValue import import com.atlassian.jira.issue.util.DefaultIssueChangeHolder import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter import // Issues returned from that JQL will get altered final searchQuery = "project = TEST" // The name of the custom field to alter final customFieldName = "TextFieldA" // The new value to set final newValue = "Love Groovy" // Get the custom field def customField = ComponentAccessor.customFieldManager.customFieldObjects.findByName(customFieldName) assert customField : "Could not find custom field with name ${customFieldName}" // Get some components def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser) def searchProvider = ComponentAccessor.getComponent(SearchProvider) def issueManager = ComponentAccessor.issueManager def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser // Perform the JQL search def query = jqlQueryParser.parseQuery(searchQuery) def searchResults =, user), PagerFilter.unlimitedFilter) // Iterate all results to update each issue searchResults.results.each { documentIssue -> def key = documentIssue.document.fields.find { == "key" }.stringValue() def issue = issueManager.getIssueObject(key) customField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customField), newValue), new DefaultIssueChangeHolder()) }
Discovered an issue? Report it here

Suggested for you

Appears in these Collections