Copy custom field value to comments


I want to copy value from a custom field over to comments with prefix custom field name and followed by the value.

e.g. say I have a custom field Driver Version with a value of say 1.2.3. I want to copy in the comments this text Driver Version: 1.2.3.

I want to this task in bulk (i.e update 2000 issues at one go).

Is this possible?


5 answers

Hi Luther

This is just an example, the need behind this is that we are trying to cut down on number of custom fields.

Once we copy the data to comments we are going to delete the custom field.

Obviously it is possible.

1. Install JJupin

2. Add the SIL runner on the dashboard and run the following script

string curruser = currentUser();

string [] keys = selectIssues("project = PRJ ..... bla bla");

for(string k in keys) {

addComment(k, curruser, "Driver version:" + customfield_54321);


3. Uninstall JJupin

Note: I did not tested the script, this is just the example, and you anyway need to put a proper JQL and customfieldId into it.

Ah, ... and JJupin has a nice feature, it shows where CF's are used. You may want to try that too ;)

Thanks.  This was helpful.  This is the script I ended up with.  I was hoping to parameterize it but never quite got that far.

// For all issues with a value for specified custom field, append CustomFieldName: CustomFieldValue to the description and as a comment.
// Set both name of custom field and ID before running this script.
// Confirm correct operation by checking at least one issue.
// This is used to avoid losing data when deleting a custom field.
string fieldName = "My Custom Field Name";
string curruser = currentUser();
string[] keys = selectIssues("\"" + fieldName + "\" is not EMPTY");
for (string k in keys) 
    // Get field value
    string fieldValue = %k%.customfield_11514;
    /* The code below does not work for field names with spaces in them, so use the line above
    string[] fieldValues = getIssueFields(k);
    string fieldValue = fieldValues[fieldName]; */
    // Append custom field name and value to description field
    %k%.description = %k%.description + "\r\n\r\n" + fieldName + ": " + fieldValue;
    // Append custom field name and value as a comment
    addComment(k, curruser, fieldName + ": " + fieldValue);

HI Nell,


Can I know where should I implement this code like post function?

I want to implement on bulk update, is it possible?

Can I know how to implement because i am new this scriptrunner? What are the requirements to implement this?




Can I ask why you would do this? Since Driver Version is already being tracked on the issues, why would you put in a comment with the exact same data?

Any comments guys?

Thanks in advance for your help


Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

59 views 0 5
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