Using JCli/Jelly/Groovy/SQL to copy from one field to another

Hi All

Okay... so it seems I am following the natural path of people using JIRA and have now reached the point where I need to copy data from one field to another in order to change the CF Type. In my case I want to take the selected value held in a CF Select list and move it to a CF number

I have spent a long time reading around the forums and I can see no definitive answer on how best to do this including an example.

I could do this semi-automatically using a transition and post function but this would be laborious as a transition would have to be added for every state; the copy done via a bulk transition and then the workflow put back to what it should be i.e. without the transition.

In my travels I did notice that JCli offeres the copyFieldValue method..but this applies to a single issue. I want to apply it to every project in the database.

Any offers on how to do this preferably with an example that I and subsequent people can use and modify in the future when they get this problem would be perfect

Many thanks

Nick

PS: Happy to be told I havent read the seminal thread where all is explained too... but I feel I have read half of Atlassian Answers today and not found what I am looking for!!

4 answers

1 accepted

As mentioned above in the end it was quicker to create the new fields and then use a post transition copy.

It does seem there is a need for a plugin to do this type of conversion & copy

1 vote

You can try https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-CopyCustomFieldValues - it has a limited set of pairs of field types for copying.

I can't remember if you can go from select to text... looks like not, but might be possible to go from single to multi, then multi to text, or you could look at the code and modify it.

I doubt there is a seminal thread because the implementation makes these kinds of conversions difficult.

In the end it was quicker to create the new fields and then use a post transition copy.

Sounds like you have already solved your problem here. Just a note that any single JCLI issue action (like copyFieldValue) can be wrapped with a runFromIssueList action to do the selection of issues the need the update.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

236 views 1 18
Join discussion

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