Forums

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

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

NickW
Contributor
November 5, 2013

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

0 votes
Answer accepted
NickW
Contributor
November 26, 2013

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
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 5, 2013

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.

0 votes
Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 20, 2013

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.

0 votes
NickW
Contributor
November 20, 2013

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

Suggest an answer

Log in or Sign up to answer