Forums

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

Cloning the labels from a issue to another

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 27, 2012

I'm trying to clone the labels while it is execute the issue cloning, Is there something missing in this script?

def labels = issue.getLabels()

issue.MutableIssue.setLabels(labels)

4 answers

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 28, 2012

There is no method issue.getMutableIssue(). And it looks like you're trying to set labels on itself (issue.setLabels(issue.getLabels)).

Are you have a problem getting a reference to the original issue?

If so it should be in transientVars.get("issue")

so you could try:

issue.labels = transientVars.get("issue").labels

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 28, 2012

Yes, my problem is to get the labels of the original issue. I have tried a lot of alternatives.

issue.labels = transientVars.get("issue").labels isn't working either, it looks like it doesn't recognize the sentence, because the issue isn't being cloned in this case.

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 29, 2012

I'm looking at the code and I don't see that I'm passing the IssueEvent into the binding for the additional code script, which means this is not going to be possible right now. Having said that, I've been through this before and made it work with the current version of the plugin, but can't find that conversation anywhere now.

I've created a bug, as this should be done without additional code: https://studio.plugins.atlassian.com/browse/GRV-107.

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 29, 2012

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.
April 12, 2012

This bug is now fixed, please try 2.0.4

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.
April 12, 2012

Awesome! Genius! I'm going to try right now!

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.
April 13, 2012

I'm using Builtin Script Listener 'Clones an issue and links', and the label isn't being cloned, so I tried to add an 'Additional issue actions' but it didn't work.

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.
April 13, 2012

Err.. hrm. I've just reread your question. What I fixed was the fact that the clone issue and create subtask builtin scripts didn't clone the labels. Are you using the built-in script or are you writing your own from scratch? It you're writing your own, I think I may still need to put the event in the binding.. but that's easy, sorry, I just overlooked it.

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.
April 13, 2012

OK, that should work now in 2.0.4. What I mean is, it should just work by default, without adding any additional script.

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.
April 16, 2012

Works perfect!

0 votes
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 28, 2012

I'm using the groovy script runner plugin. I added a Listener for an event called 'Error from tryouts'.

This is my script for the post-function:

def oldsummary = issue.summary

issue.summary = 'Error - ' + oldsummary

def cf = "customfield_10407"

def fieldname = customFieldManager.getCustomFieldObject(cf)

issue.description = issue.getCustomFieldValue(fieldname)

issue.originalEstimate = 0

--All above this commentary works fine

def labels = issue.getLabels()

issue.MutableIssue.setLabels(labels)

--This is the part I'm having trouble

0 votes
Dieter
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 28, 2012
The safest way i found to update another issue than the one on which the workflow transition is being executed is to use issueManager.updateIssue().
0 votes
Dieter
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 28, 2012
Can you give us more context? E.g. It would be good to see the workflow post functions and more of the groovy script. E.g. this snippet itself cannot work since there is no issue.store and no reindex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events