Adding to description a customfield value in transition

Ramiro Pointis
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 22, 2012

Topic adding a listener that clones an issue:

I have a customfield called 'Detected Error' and I want that in Additional Issue Actions the description of the cloned issue to store the value of this customfield.

I've done a lot of tests but I can't figue it out.

For example it isn't working this way:

def cf = "customfield_10407"
def fieldname = customFieldManager.getCustomFieldObjects(cf)
issue.description = issue.getCustomFieldValue(fieldname)

1 answer

1 accepted

1 vote
Answer accepted
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.
March 22, 2012

You should be able to do:

issue.description = cfValues["Name of custom field"]

Use the name of the CF, not the ID. It should work from memory, but not tested... LMK.

BTW your way should work but you need getCustomFieldObject not getCustomFieldObjects. The plural form returns a list.

Ramiro Pointis
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 22, 2012

I can't believe that 'S' was my problem! I wasted almost a complete day with this! Now is working!...

Thanks Jamie!

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.
March 22, 2012

Yeah... it happens ;-) Try to get into the habit of using some log.debug statements and change your log level, then you can see easily what's getting returned.

Ramiro Pointis
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 25, 2012

Jamie, from where I can take the field values? For example, when the issue is cloned, the timeestimated should not be cloned. So, It should be like:

issue.timeOriginalEstimate = ''

issue.timeoriginalEstimate = ''

issue.timeoriginalestimate = ''

Are this names related to the column names in database?

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.
March 25, 2012

issue.originalEstimate = 0 // IIRC

They may be related to the column names but the javadoc is the place to look. Also you should probably start a new question for this, not many people will look at answered questions.

Ramiro Pointis
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 25, 2012

Thanks Jamie, I'll trasspass this to a new question.

Suggest an answer

Log in or Sign up to answer