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 ?


3 answers

1 vote
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 :)

@Jonas Gomes Hi Jonas , We are facing the same issue as above and trying out your code to resolve it, but we are getting a parsing error exception as below:

Error parsing 'text/html;charset=UTF-8' response
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is '<' with an int value of 60
Unable to determine the current character, it is not a string, number, array, or object
line number 11
index number 10
at groovy.json.internal.JsonParserCharArray.decodeValueInternal(
at groovy.json.internal.JsonParserCharArray.decodeValue(
at groovy.json.internal.JsonParserCharArray.decodeFromChars(
at groovy.json.internal.JsonParserCharArray.parse(
at groovy.json.internal.BaseJsonParser.parse(
at groovy.json.JsonSlurper.parse(

link for code and error:

Do you have any idea , how to fix this error. We tried different approaches but no luck!!!

Any help would be appreciated. Thanks in advance

Hi Mamta, have you tried put that URL in the browser? I think that response is returning a HTML instead JSON, because u have this Exception 

Error parsing 'text/html;charset=UTF-8' response
groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

U have to test using CURL before put in the Code, my first idea :D


Have a nice day Mamta.

@Jonas Gomes Thanks Jonas it worked for us :)

Has anyone been able to figure out how to get IssueImpl to cast to SimpleIssueAtributes?


We are trying to set the Parent Link based on an issue link and continue to run into this issue.

We were able to do this through the API as well.




 def userName = "username"
def password = "password"
def authString = "${userName}:${password}".getBytes().encodeBase64().toString()
def jiraBaseURL = ''
def jsonSlurper = new JsonSlurper()
def jsonObj = new JsonSlurper().parseText('{ "fields": { "customfield_17617": "'+ParentIssue+'"} }') //customfield_17617 is Parent Link ID
log.debug ("jsonStr..." + jsonObj)
def client = new RESTClient(jiraBaseURL)

PL.updateValue(null, uissue, new ModifiedValue(uissue.getCustomFieldValue(PL), null),changeHolder)
client.put(path: "/rest/api/latest/issue/"+uissue,
body: jsonObj,
headers: [Accept: 'application/json', Authorization: "Basic ${authString}"]
}catch(final HttpResponseException e){
log.warn e

Nice Job Kevin. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,438 views 0 8
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