Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy "Fix version/s" in to a custom field

NEGAR JALALIAN
Contributor
May 9, 2019

Hi 

I have over 2000 issues which I need to copy the value of "Fix version/s" in to another custom field. Is there any simple possible way to do that?

I was hoping to do it by buck change but I was so optimist :)

3 answers

1 accepted

1 vote
Answer accepted
Jack Brickey
Community Champion
May 9, 2019

Without and addon, here is what I would try.

  1. edit the workflow and add in a temporary (?) reentrant transition from a status back to itself. Give it a unique name. Note if your issues are in multiple statuses you will need to do for each status.
  2. add a post function to this transition to copy the field.
  3. use bulk edit to execute the transition. Again if your  shoes are in multiple statuses you will need to do the bulk update on the individual statuses separately 

 Now with the historic issues out-of-the-way, you could consider adding a post function to a transition in your workflow to always copy that feel if you desire.

 If you happen to have a scripting addon such as Scriptrunner than you consider using it.

NEGAR JALALIAN
Contributor
May 9, 2019

thanks ! well I didn't want to buy a new addon and I used this way .. it was too much work though ... I had many status and different issue type had different workflow

0 votes
Prashantgouda KARAKANAGOUDR November 9, 2022

Hi,

 

If you want this to be automated anytime an issue event happens then you can use below script with Scriptrunner in place.

 

//Below script copy the fix version value to another custom field.

--------------------------------------

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.MutableIssue

def issue = (MutableIssue) event.issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def fv = issue.getFixVersions().join(", ");
log.warn(fv)

def cfid2 = 12500 //Replace this value with your customfield ID
def cf2 = customFieldManager.getCustomFieldObject(cfid2)

def cf2value = issue.getCustomFieldValue(cf2)

cf2.updateValue(null, issue, new ModifiedValue(cf2value, fv), new DefaultIssueChangeHolder())
---------------------------------------


Regards,
Prashant
0 votes
Tarun Sapra
Community Champion
May 9, 2019

Hello @NEGAR JALALIAN 

You can follow as @Jack Brickey  suggested without an add-on, but if you have an add-on like Script runner.

You can write a script and do the following

  • Write a script which does a JQL query to fetch all the issues.
  • Update all issues in a loop to copy the fixVersion in a custom field (text field) in a comma separated manner. 

Most of the scripts for the above 2 steps are already available on the community posts.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events