Updating custom field value on moving between projects

Alexey Dorofeyev
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.
August 10, 2017

I've got custom field type (numeric) field.

Value of this field is id of one of active objects, linked to specific project.

So when i'm moving issue to another project, i wish to update custom field value according to new project.

How this can be done?

1 answer

0 votes
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.
August 10, 2017

Code.

Two options spring to mind - hacking the "move" functionality in the core of JIRA, and not actually doing it in the move at all.

The second option means writing a listener that could catch the "move" event, have a look at the issue and change the number as appropriate (technically, this would happen after the move, not as part of it, but it will usually be fast enough that the users will see it as the same action)

Alexey Dorofeyev
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.
August 10, 2017

Second is not an option, because there's no way to automatically assign new value.

Basically, i need my field to work just like "fixVersion" do when issue is moved to another project.

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.
August 10, 2017

It asks for a fix version because fix version lists are different between projects.

You could configure your field so that it has two separate option lists, that would cause similar behaviour.

Alexey Dorofeyev
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.
August 16, 2017

This is exactly what i need.

Where this confuguration should be done?

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.
August 16, 2017

It's in the field context stuff.  Custom fields -> find your field -> configure

You should find a screen that says "this field belongs to some projects and has the following options", along with the ability to edit the options.

Towards the top of that, you'll find an "add context" button, use that and choose which project(s) or issue type(s) to apply it to.  Then define the new list.

Note - this may be destructive, I can't remember how it works!

Alexey Dorofeyev
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.
August 18, 2017

Thing is, that value of my custom field is actually ID of active object, which is created/updated/deleted through custom editor in project administration interface.. 

I've examined JIRA MoveIssueUpdateFields class and found that there's hasValue() method of OrderableField object, which determines if the field has a value for the given issue. Fix version uses that.

Bad news is that custom fields created through "customfield-type" plugin module doesn't inherit OrderableField.

Suggest an answer

Log in or Sign up to answer