Copy value of custom field to another field when updated

Deleted user May 14, 2014

Hi.

How can I copy a value of a custom field in JIRA whenever it's updated? I know how to do this in a transition, the field however may be updated outside transitions.

Thanks.

-a-

4 answers

1 accepted

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 14, 2014

Every change to an issue fires an "event" of some sort. You can catch these events in "listeners" and then run much the same code as you have in a transition.

I'd look at Jamie's "Script runner" plugin first - that lets you write code in a listener (or post function etc) without any of the mucking around with the addon framework or coding and compiling outside Jira. It's also free (and frankly, pretty much a standard plugin nowadays)

1 vote
Radu Dumitriu
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.
May 14, 2014

First question is: why you need it? There's a nice history JIRA manages for the issue, and your field values are in there .... (1)

If you still need to copy the value to another custom-field, you should take a look at plugins like JJUPIN (live fields) [paid] or (maybe) Jamie's Behaviours [free] add-on.

Edit: (1) - You can use for instance Kepler Custom Fields [free] plugin (or any calculated scripted field) and print the value from the history.

0 votes
Santhosh Kumar May 13, 2021

You can try this Behavior script: 

def cf1 = getFieldByName("Cf1 Date")
def sub_cf1 = cf1.toString().split("value: ")[1]
def cf2 = getFieldByName("Cf2 Date")
cf2.setFormValue("${sub_cf1}")

0 votes
Deleted user May 15, 2014

Thanks @Nicand @Radu, Jamie's "Script runner" plugin did the trick (and so much more I was unaware of was possible).

Saravanan Ravikumar December 19, 2018

Hi,

Can you provide the script which you used.

Like Michael Röscher likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events