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


Update a Custom Field Across all the Linked Issues - ITSM


Place this script in a Custom Listener, to automatically update the value of a custom field across all linked issues.

  • Navigate to Add-ons > Script Listeners using the Administration Cog in the top right corner.
  • Click Add New Item and select Custom Listener.
  • Configure the screen and add the code.
  • Click Add.


Detailed use case example: Script Listener for Updating All Linked Incidents

Good to Know

  • Associate this script with the Issue Updated event listener.


  • 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 com.atlassian.jira.issue.util.DefaultIssueChangeHolder import java.time.LocalDateTime import java.time.format.DateTimeFormatter // the name of the custom field to update final customFieldName = 'Workaround' def issue = event.issue def change = event.changeLog.getRelated('ChildChangeItem').find { it.field == customFieldName } // Was not the 'Workaround' field that changed, do nothing if (!change) { return } def linkedIssues = ComponentAccessor.issueLinkManager .getOutwardLinks( .findAll { in ['Problem/Incident'] && == 'Alert' } // There are no linked 'Alerts' with 'Problem/Incident' link, do nothing if (!linkedIssues) { return } def customField = ComponentAccessor.customFieldManager.getCustomFieldObjects(issue)?.find { == customFieldName } def newWorkaround = """h4. Workaround - ${'dd/MMM/yyyy HH:mm'))}
${change.newstring}""" linkedIssues.each { def linkedIssue = it.destinationObject def oldValue = linkedIssue.getCustomFieldValue(customField) def newValue = newWorkaround + oldValue customField.updateValue(null, linkedIssue, new ModifiedValue(oldValue, newValue), new DefaultIssueChangeHolder()) }
Discovered an issue? Report it here

Suggested for you

Appears in these Collections