Setting specific custom field values with JIRA Clone Plus plugin

Scott Dudley [Inactive]
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.
February 18, 2013

Hi all,

Can anyone provide an example of using the Clone Plus plugin to set a custom field to a specific value when copying an issue? This is with CP 1.3.1 on JIRA 4.4.5, and I'm using the standard "Clone+" operation.

I've read the documentation (which seems rather cryptic) and it hasn't given me any clues. My latest attempts look like the block below. The field in question is number 10204, which is named <fieldname>, and it's a Number field. My goal is to have this field set to -1 whenever an issue is cloned.

fieldIncludes = customfield_10204
set.customfield_10204=-1
set.&lt;fieldname&gt;=-1
plus.set.customfield_10204=-1
set.10204=-1
set.cf10204=-1

No matter what I try in the clone-plus.properties file, the target issue always receives an empty value for the specified custom field.

Any pointers to the correct syntax would be appreciated!

Thanks,
Scott

1 answer

1 accepted

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
February 19, 2013
You need a custom clone operation to set field values.
  1. How to use clone properties for customization explains how to enable a custom clone operation. For instance, say the Clone+ (custom 1)
  2. Eidt your clone-plus.properties and add something like
    1.set.customfield_10204 = -1
    or 
    1.set.&lt;fieldname&gt; = -1
  3. Disable and enable the plugin to have your property changes become active.
Scott Dudley [Inactive]
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.
March 5, 2013

With that in mind, if we are not going to be able to make the custom clone work without modifying the screens, is there then any possibility of having the semantics of "fieldExcludes" updated to use a field's default value (if any) rather than simply setting it to null? That would allow us to clone the issue without needing to resort to a custom clone operation in the first place.

Thanks!

Scott Dudley [Inactive]
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.
March 5, 2013

Bob,

Thanks for your note. The tip to using the "custom clone" operations was helpful. (As a side note, I couldn't find anywhere in the documentation that this is spelled out. Unless I missed it, it might be helpful for other users if to add something to the introduction page which explains why you might need to use a custom clone operation versus a standard clone plus, and to emphasize that the default clone operations cannot be modified.)

Having written that, I am still unable to get it to work in our scenario. Here is what my configuration looks like now:

fieldIncludes = customfield_10101,customfield_11011,customfield_10204
fieldExcludes = customfield_11100, customfield_11101, customfield_11102, customfield_11103, customfield_11104, customfield_11105, customfield_11106, customfield_10300

1.condition.SBOX.*.* = true
1.label=MyClone+
1.set.customfield_10204=-1
1.set.customfield_11011=http://www.yahoo.com
1.set.summary=Foobar

After making these changes, I see that the custom clone operation exists in the menu with the correct "MyClone+" label, and although it does set the summary to "Foobar", the two custom fields are still not set.

Perhaps related to this issue is the fact that those two fields (10204 and 11011) are not available on the screen shown to the user during the clone operation. We only ever make those two custom fields available on the edit and/or view screens, never on create. Could this be related?

For what it is worth, our end goal is to simply have custom field 10204 set to its default value (which is -1) when performing the clone. We first started out by putting this field in the fieldExcludes list...but then the field ended up receiving a null value instead of the default value, which isn't what we wanted, and which brought us over to the custom clone area.

(continued in next comment...)

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
March 5, 2013

This is getting too detailed for here. Can you please create an issue so it can be tracked?

Scott Dudley [Inactive]
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.
March 5, 2013

Done--JCPP-99. Thanks!

Suggest an answer

Log in or Sign up to answer