Can i update custom field value of Parent Link type via workflow?



i'm trying copy value of a custom field to another custom field, this another is a Parent Link custom field. 
I tried of 2 methods: 
1) i tried a copy value of custom field to another custom field using post function, no success...

2) same method, but using sample groovy with updateCustomFieldValue()

using this code: 

def issue = ComponentAccessor.getIssueManager().getIssueObject("T-7665") as MutableIssue
def cfEpicLink = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(13982L)
def cfParentLink = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(23280L)

def changeHolder = new DefaultIssueChangeHolder();
cfParentLink.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(cfParentLink), cfEpicLink.getValue(issue)),changeHolder);


I got the same error using this 2 ways. Check Out


2017-06-16 18:59:18,552 WARN [common.UserScriptEndpoint]: Script console script failed: java.lang.ClassCastException: com.atlassian.jira.issue.IssueImpl cannot be cast to com.atlassian.rm.jpo.env.issues.SimpleIssueAttributes at com.atlassian.rm.jpo.customfields.parent.ParentCustomFieldType.createValue( at com.atlassian.jira.issue.fields.ImmutableCustomField.createValue( at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue( at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue( at com.atlassian.jira.issue.fields.OrderableField$ Source)

Is impossible to do this or have a way ?


1 answer

This widget could not be displayed.
Steven Behnke Community Champion Jun 16, 2017

It's very possible. You're trying to push a round peg into a square hole though. That's why you're getting a Class Cast Exception.

I'm not sure, you should log the values so you can get a better idea of what's happening. It appears that Epic Link field from JIRA Software accepts/returns an IssueImpl object. However, this contrasts with the Parent Link from Portfolio: This field accepts/returns a "SimpleIssueAttributes" object.

You'll have to figure out how to map between the two of them yourself. If you post some results of logging the values of the objects, perhaps I can help more.

Thanks for asnwer Steven

I managed via rest, after so many attempts it was.


Thanks for attention anyway

Hi Steven, Jonas,

I have the same problem, but it seems like I am not able to solve that problem on my own :(.

I can't find any documentation about the SimpleIssueAttributes class and so, I am not able to find out the way to cast correcty... 

Jonas, how did you solve this via rest?

We want to use different issuetypes for different departments and I want to make it as easy as possible to use the issues and Portfolio so there can't be any excuses for not using it.... ;)

Would be great if you have an advice or something...




Hi Katya, 

I relied on this documentation, where we talk about the update custom field via rest. Look at my code that solved the problem. 

Check this documentation:

import groovy.json.*
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

def newParentLink = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(0000L) <- here is ID custom field what u have to update.
def jsonObj = new JsonSlurper().parseText('{ "fields": { "customfield_23280": "'+newParentLink+'"} }') //customfield_23280 is Parent Link ID
def parentLink = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(23280L) <- id parent link custom field

def userName = "user"
def password = "password"
def fullAddress = "youadress/jira/rest/api/2/issue/${issue.key}"
def authString = "${userName}:${password}".getBytes().encodeBase64().toString()

def client = new RESTClient(fullAddress)

//necessary to overwrite the value of custom field, via rest only update if custom field have value null.
parentLink.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(parentLink), null),new DefaultIssueChangeHolder())
client.put(path: fullAddress,
body: jsonObj,
headers: [Accept: 'application/json', Authorization: "Basic ${authString}"]
}catch(final HttpResponseException e){
log.warn e

i hope this helps you get the solution. 

Good Luck :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

515 views 3 18
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you