Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scripted Field to copy custom field from Linked Issues

I am trying to copy the value of a custom field from the linked issue. It works good with one to one link but doesnt work when they have the same issue linked to multiple issues. Example: Ab is the project where the scripted field is present, XY is a project where the value is present when Ab-1 and Ab-2 has link with XY-1 the script works for only Ab-1 but Ab-2 is null.  Any help appreciated 



3 answers

1 accepted

3 votes
Answer accepted

Here is a script that will copy the values from a Custom Field into the Linked Issues' Custom Fields:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.option.Option

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueLinkManager = ComponentAccessor.issueLinkManager
def issueManager = ComponentAccessor.issueManager
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def issue = issueManager.getIssueByCurrentKey('JRA-2') // change this to match your main issue key
def customField = customFieldManager.getCustomFieldObjectsByName('MultiSelectA')[0] // change this to match your custom field name

def customFieldValue = issue.getCustomFieldValue(customField)
def issueService = ComponentAccessor.getIssueService()
def issueInputParameters = issueService.newIssueInputParameters()

def linkedIssues = issueLinkManager.getLinkCollection(issue, currentUser).getAllIssues()

for (int i = 0; i < linkedIssues.size(); i++) {
log.debug("Updating issue: ${linkedIssues[i]}")

// This is for the Multi Select List. It will change if you work with another type of Custom Field
// For example, you won't have to loop through a text field, you would just pass what was in customFieldValue
def values = customFieldValue.collect{ Option option ->

issueInputParameters.with {
addCustomFieldValue(customField.idAsLong, *values) // *values is something Groovy does to destruct a list into plain arguments

def updateValidationResult = issueService.validateUpdate(currentUser, linkedIssues[i].id, issueInputParameters)

if (updateValidationResult.isValid()) {
def finalUpdateResult = issueService.update(currentUser, updateValidationResult)
} else {

Deleted user Sep 02, 2019


the script works fine with multiselect fields, but how do I get it to work with Singe User Picker custom fields? 

best regards 

Hi @[deleted] ,

Have you found the solution for your question?

Can come one please help?




Hi @Carmen Creswell [Adaptavist] 

Could you please help here?




@Avinashhave you been able to create the script?

I also need a script which copies Region field value from linked issue to Region field of the issue where the link was created.

Can you share it?

Hi @Jiri Kanicky 

Yes, What type of field in JIRA is region field value ? 

Hi. Its a Select List (single choice) custom field.

I have the following setup:

  • Project_Support
  • Project_Surveys

When I link Support ticket to Survey ticket (from Survey ticket), I need to pull the Support ticket Region field value and update the Survey ticket Region field value.

Thanks for your help.

0 votes

I think your only reference to issue (the current issue, AB-1 or AB-2) is where you're assigning linkedTasks's initial value. That leads me to believe that there could be some sort of flaw in the logic. Are you sure AB-2 has the same direction of link at AB-1?

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events