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

how to append value updated in Single line text custom field to Multi line text custom field using Groovy script?


Want to copy value updated in Single line text custom field (i,e Doc Version) to Multi line text custom field (i,e All Versions) using Groovy script?

//assuming this is a sigle line text field
def textFieldA = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Doc Version")
//assuming this is a Multi line text field
def textFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("All Versions")
issue.setCustomFieldValue(textFieldB, textFieldA) ==> is it appends values???
The "Doc Version" custom field value will get updated by issue assignee multiple times in my workflow @ different workflow transition steps.
I want to save all the version updated by assignee instead of overwriting it, I am trying to copy values into another Multi line text custom field i,e All Versions for Team's future reference.
Is this the right way or using one Multie line text custom field itself, we can try to preserve the previous values and get appended with latest version values using only one field itself? Please advice.   
  • Manju 

2 answers

1 accepted

1 vote
Answer accepted

Got it, the below script works as per my requirement.

'\n' between prev and current field value adds new line between 2 values. It works. Thanks.

import com.atlassian.jira.issue.Issue 
import com.atlassian.jira.issue.fields.CustomField 
import com.atlassian.jira.component.ComponentAccessor
CustomField textFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("SDD Document All Versions") 
issue.setCustomFieldValue(textFieldB, String.valueOf(issue.getCustomFieldValue(textFieldB)) + '\n' + String.valueOf(issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("SDD Baselined Doc Version"))))
  • Manju

Try this code

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField

CustomField textFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("All Versions")

issue.setCustomFieldValue(textFieldB, issue.getCustomFieldValue(textFieldB) + issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Doc Version")))

Thanks for your prompt response Vasiliy.

I am getting the below ERROR, when I tried to use the script you had suggested in Custom script post-function.

Static Type Checking - cannot find matching method

java.lang.Object#plus(java.lang.Object). Please check if declared type is right and if method exists

Possible solutions: use([Ljava.lang.Object;), is(java.lang.Object), use(java.lang.Class, groovy.lang.Closure), split(groovy.lang.Closure), wait(), find() @ line 8, column 39.


I am using JIRA Software 7.2.7 and SR version is 4.3.16

Hi Vasiliy,

Was trying alternate option of Using "Update Issue Custom Field" Add Post Function To Transition, updates an issue custom field to a given value. So I am trying to get the value from another custom field and trying to append it to the another 'Issue Custom Field' using this post function.

But I am unable to get the value of Custom Field Value from custom field id i,e customfield_10104

1) Issue Custom Field: SDD All Versions

2) Custom Field Value: customfield_10104 ==> this is another cusomt field id, from which I am trying to copy the value to 'SDD All Versions' custom field) here simply entering the ID of the option to be selected to get the value.


Append value:         If set, the given value will be appended to the field. Or if field supports multiple values, then the given value will be set without unsetting other ones.

Please make sure that the value you enter is valid for custom field its datatype and context configuration for the project using this workflow. Otherwise, the transition may fail at execution time. Additionally to enter text or numbers as value, you may use the following:

  • You may use macro '%%CURRENT_USER%%' to insert the function caller.
  • You may use macro '%%CURRENT_DATETIME%%' to insert the current date and time.
  • You may use macro '%%ADD_CURRENT_USER%%' to append the function caller. Obsolete please use append option instead with user macro above.
  • For Cascading Select fields, you may either use the value of the option to be selected, no need to add the parent for childs. Or simply enter the ID of the option to be selected.


  • Manju 

Lets try this one:

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.fields.CustomField

CustomField textFieldB = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("All Versions")

issue.setCustomFieldValue(textFieldB, String.valueOf(issue.getCustomFieldValue(textFieldB)) + String.valueOf(issue.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Doc Version"))))

Thanks Vasiliy Zverev.

The shared script is able to append the values, but is it possible to copy values into "All Versions" from "Doc Version" into new line? As "All Versions" customfield is a Multi line Text.

So that reading values will be easier for JIRA Assignee's reference. Please advice how to do this in the shared script. Thanks.

Doc Version: 012345 (first time updated value)

Doc Version: 67890 (second time updated value)


The appended values started with "null" value. How to remove the "null" from the result

RPA-Cumu-Fulfilled-Res-Offshore:null[104294 - Bhandary,Venugopala, 104842 -                                                                       Shaikh,Anjumaara Mubarak]

@Manjunatha K R @Tushar @Vasiliy_Zverev  at which place i should run this scrtipt?? i am running this in behavior am getting an error for the issue. the "issue" variable is undeclared?.please help me out where should i run this script?

This is for postfunction, condition or a validator. In these cases there is a variable issue is defined and represents cuurent issue.

To run it separatelly you should define this variable of class Issue or MutableIssue.

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...

322 views 9 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