Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Groovy script problem

I copy the following copy from adaptavist library:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueFieldConstants
import com.atlassian.jira.issue.Issue

// the name of the field to copy
final String fieldNameToCopy = "Priority";

// leave blank to copy from the last linked issue (regardless the link type)
final String issueLinkTypeName = "Blocks"

def fieldManager = ComponentAccessor.fieldManager

def fieldToCopy = fieldManager.allAvailableNavigableFields.find { == fieldNameToCopy }
if (!fieldToCopy) { "Could not find field with name $fieldNameToCopy"

def linkedIssues = ComponentAccessor.issueLinkManager.getOutwardLinks(
if (!linkedIssues) { "There are no linked issues"

if (issueLinkTypeName && !(issueLinkTypeName in linkedIssues*.issueLinkType*.name)) { "Could not find any issue, linked with the $issueLinkTypeName issue type"

def linkedIssue = issueLinkTypeName ?
linkedIssues.findAll { == issueLinkTypeName }.last().destinationObject :

def fieldToCopyId =

switch (fieldToCopyId) {
case fieldManager.&isCustomFieldId:
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(fieldToCopyId)
def linkedIssueCustomFieldValue = linkedIssue.getCustomFieldValue(customField)
issue.setCustomFieldValue(customField, linkedIssueCustomFieldValue)

case IssueFieldConstants.COMPONENTS:
def commonComponents = linkedIssue.components.findAll { in issue.components*.name }

case IssueFieldConstants.FIX_FOR_VERSIONS:
def commonFixedVersions = linkedIssue.fixVersions.findAll { in issue.fixVersions*.name }

case IssueFieldConstants.AFFECTED_VERSIONS:
def commonVersions = linkedIssue.affectedVersions.findAll { in issue.affectedVersions*.name }

issue[fieldToCopyId] = linkedIssue[fieldToCopyId]


But I get unknown methods error. Don't know why...  

Someone could help me. thanks


1 answer

0 votes
Ravi Sagar Community Leader Oct 24, 2019

Hi @Marcela Junyent 

Where are you running this script? and can you share the link from where you copied it?



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

272 views 8 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you