Script Runner - Custom Script Listener cannot load

I've read the other postings here and tried the things those suggest but I still cannot get Script Runner to create a Custom Script Listener.

I am getting no errors no log entries, nothing. JIRA just spins the entire time so no idea what the hang up is.

I did try Disabling and Enabling the plugin again as I did for a earlier problem.

JIRA 6.3.7 and Script Runner 3.0.6

I've created a folder under the default Scripts folder called listeners. I put my groovy file there. 

Then in the Script Runner configuration section I put the path to the script just as listeners.myscript   which is what all the examples seemed to be showing.

So to be clear the file lives on my JIRA server at <JIRA_HOME>/scripts/listeners/myscript.groovy   

 

 

3 answers

1 accepted

Dupe Question, please see https://answers.atlassian.com/questions/322596

for possible help and continued conversation.

0 votes

What's the contents of myscript.groovy?

I basically copied an example from the Script Runner site and added a little bit of code. Here you go: package listeners; class myscript extends AbstractIssueEventListener { Category log = Category.getInstance(myscript.class) @Override public void workflowEvent( IssueEvent event ) { Long eventTypeId = event.getEventTypeId(); if( eventTypeId.equals( EventType.ISSUE_UPDATED_ID ) ) { List<GenericValue> changeItemList = null; try { changeItemList = event.getChangeLog().getRelated( "ChildChangeItem" ); } catch( GenericEntityException e ) { // Error or do what you need to do here. e.printStackTrace(); } if( changeItemList == null ) { // Same deal here. return; } Iterator<GenericValue> changeItemListIterator = changeItemList.iterator(); while( changeItemListIterator.hasNext() ) { GenericValue changeItem = ( GenericValue )changeItemListIterator.next(); String fieldName = changeItem.get( "field" ).toString(); if( fieldName.equals( 'fixVersions' ) ) // Name of custom field. { Object oldValue = changeItem.get( "oldvalue" ); log.debug "Old Value: ${oldValue}"; Object newValue = changeItem.get( "newvalue" ); log.debug "New Value: ${newValue}"; } } } } }

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,968 views 12 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