How can I prevent Labels from being copied when creating a clone of an Issue with the JIRA ScriptRunner plugin?

We are using the ScriptRunner JIRA plugin to clone issues when certain workflow transitions occur. We noticed that Labels are being copied from the source Issue to the clone, and we would like to avoid that. We found that we could prevent attachments from being copied to the clone by adding the following line in our script.

 checkAttachment = {attachment -> false}

 Is there a similar solution that we can use to prevent Labels from being copied?

 Thank you very much in advance.

4 answers

0 vote

Yeah sorry, so it turns out this not that simple, I created GRV-511.

Normally I would say you just the additional code section to unset the labels like:

import com.atlassian.jira.issue.MutableIssue
 
issue.setLabels([] as Set)

unfortunately that doesn't work in this case.

You could try adding a post-function to the workflow which removes labels if there is a cloners or whatever link present, but I'm not sure if the link will have actually been added at that stage.

Thank you Jamie. I appreciate you looking into it. I will explore the workaround you mentioned in the meantime.

All the best, Jeff

Hi Jamie, 

I tried setting up a separate script as a post-function, but unfortunately it too runs before the Labels are copied to the Issue clone. For now, I guess we are left with just leaving the Labels (or deleting them manually). I'll keep an eye on GRV-511 in the meantime.

Thanks,

Jeff

Hi Jeff, Please where you put this code " checkAttachment = {attachment -> false}" ? I tried to put it in additional code(clone issue and link) in my post function , but it not worked. Best Regards Fabio

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

212 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you