Script Listener script only works once

Hi,

We have a custom script running in a Issue Created script listener. We basically need to read the labels on an issue that has been created which we do by using:

LabelManager labelManager = ComponentAccessor.getComponent(LabelManager.class)
def labels = labelManager.getLabels(issue.id).collect{it.getLabel()}

After updating the script it works as intended and it returns the labels that has been assigned to it on creation but this only works on the first issue created after updating the script. Any additional issues created just return an empty list of labels even though there is a label on the issue. I've checked the issue id and it is getting the correct issue everytime the script is run.

Is there something that needs to be reset or is their an easier way of getting the labels?

Thanks

1 answer

0 votes

Hi Alan.

May we have your scriptrunner version number and your Jira version as well? I want to test this in your version to make sure that I can debug and see what's wrong.

Cheers!

 

If we get your full script, with screenshots that show how you set this up, that would be very useful for debbuggin purposes. If you want you can use our own platform at:

https://productsupport.adaptavist.com/projects/SRJSUP/queues

Hi Daniel,

We're using ScriptRunner version 4.3.18 and our JIRA version is 7.3.

I've managed to get a work around for it by using the Issue Updated listener instead of the Issue Created as we remove the label after we get the String from it and most likely won't be re-applying it but we would prefer to have this on Create rather than every update.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot